Skip to content

Commit 479cad4

Browse files
committed
doc
1 parent 9d91f97 commit 479cad4

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

Readme.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
Matlab users coming from other languages often notice the missing functionality contained within this user-developed, unofficial "stdlib" for Matlab.
88
These system "sys", file I/O "fileio" and HDF5/NetCDF "hdf5nc" function are useful across several of our own and others projects.
99

10-
Selftests can be run from that matlab-stdlib/ directory:
10+
Self-tests can be run from that matlab-stdlib/ directory:
1111

1212
```matlab
1313
runtests('stdlib.tests')
@@ -31,13 +31,31 @@ Check that a dataset exists in file:
3131
h5exists(filename, dataset_name)
3232
```
3333

34+
---
35+
3436
Save a variable to a dataset.
3537
If dataset exists, the existing dataset shape must match the variable.
3638

3739
```matlab
3840
h5save(filename, dataset_name, dataset)
3941
```
4042

43+
The shape of the dataset can be controlled by specifying the "size" argument.
44+
This is particularly useful when writing HDF5 files to be used in other programming languages where dimensional shapes are important.
45+
Matlab may collapse singleton dimensions otherwise.
46+
47+
```matlab
48+
h5save(filename, dataset_name, dataset, "size", [3,1])
49+
```
50+
51+
Likewise, the type of the dataset may be explicitly specified with the "type" argument:
52+
53+
```matlab
54+
h5save(filename, dataset_name, dataset, "type", "int32")
55+
```
56+
57+
---
58+
4159
Get the dataset size (shape)
4260

4361
```matlab

0 commit comments

Comments
 (0)