Main Content

matlab.io.hdf4.sd.setExternalFile

Namespace: matlab.io.hdf4.sd

Store data in external file

Syntax

setExternalFile(sdsID,extfile,offset)

Description

setExternalFile(sdsID,extfile,offset) moves data values (not metadata) into the external data file extfile starting at the byte offset, offset.

Data can only be moved once for any given dataset. The external file should be kept with the main file.

This function corresponds to the SDsetexternalfile function in the HDF library C API.

Examples

import matlab.io.hdf4.*
sdID = sd.start('myfile.hdf','create');
sdsID = sd.create(sdID,'temperature','double',[10 20]);
sd.setExternalFile(sdsID,'myExternalFile.dat',0);
sd.writeData(sdsID,[0 0],rand(10,20));
sd.endAccess(sdsID);
sd.close(sdID);