matlab.io.hdf4.sd.writeData
Package: matlab.io.hdf4.sd
Write to data set
Syntax
writeData(sdsID,data)
writeData(sdsID,start,data)
writeData(sdsID,start,stride,data)
Description
writeData(sdsID,data)
writes all the data
to the data set identified by sdsID
.
writeData(sdsID,start,data)
writes a contiguous
hyperslab to the data set. start
specifies the
zero-based starting index. The number of values along each dimension
is inferred from the size of data
.
writeData(sdsID,start,stride,data)
writes
a strided hyperslab of data to a grid datafield. The number of elements
to write along each dimension is inferred either from the size of data
or
from the data set itself.
start
and stride
use zero-based
indexing.
This function corresponds to the SDreadchunk
function
in the HDF library C API, but because MATLAB® uses FORTRAN-style
ordering, the start
and stride
parameters
are reversed with respect to the C library API.
Examples
Write to a 2D data set.
import matlab.io.hdf4.* sdID = sd.start('myfile.hdf','create'); sdsID = sd.create(sdID,'temperature','double',[10 20]); data = rand(10,20); sd.writeData(sdsID,[0 0],data); sd.endAccess(sdsID); sd.close(sdID);
Write to a 2D unlimited data set.
import matlab.io.hdf4.* sdID = sd.start('myfile.hdf','create'); sdsID = sd.create(sdID,'temperature','double',[10 0]); data = rand(10,20); sd.writeData(sdsID,[0 0],data); data = rand(10,30); sd.writeData(sdsID,[0 20],data); sd.endAccess(sdsID); sd.close(sdID);