Main Content

hdfvs

Gateway to VS functions in HDF Vdata interface

Syntax

[out1,...,outN] = hdfvs(funcstr,input1,...,inputN)

Description

hdfvs is the MATLAB® gateway to the VS functions in the HDF Vdata interface.

[out1,...,outN] = hdfvs(funcstr,input1,...,inputN) returns one or more outputs corresponding to the VS function in the HDF library specified by functstr.

There is a one-to-one correspondence between VS functions in the HDF library and valid values for funcstr. For example, hdfvs('detach',vdata_id) corresponds to the C library call VSdetach(vdata_id).

Access Functions

Access functions attach, or allow access, to vdatas. Data transfer can only occur after a vdata has been accessed. These routines also detach from, or properly terminate access to, vdatas when data transfer has been completed.

Value of funcstrFunction SyntaxDescription
'attach'vdata_id = hdfvs('attach',file_id,vdata_ref,access)Establishes access to a specified vdata. access can be 'r' or 'w'.
'detach'status = hdfvs('detach',vdata_id)Terminates access to a specified vdata.

Read and Write Functions

Read and write functions read and write the contents of a vdata.

Value of funcstrFunction SyntaxDescription
'fdefine'status = hdfvs('fdefine',vdata_id,fieldname,data_type,order)Defines a new vdata field. data_type is character vector or string scalar containing the HDF number type. Specify data_type as one of these values: 'uchar8', 'uchar', 'char8', 'char', 'double', 'uint8', 'uint16', 'uint32', 'float', 'int8', 'int16', or 'int32'.
'setclass'status = hdfvs('setclass',vdata_id,class)Assigns a class to a vdata.
'setfields'status = hdfvs('setfields',vdata_id,fields)Specifies the vdata fields to be written.
'setinterlace'status = hdfvs('setinterlace',vdata_id,interlace)Sets the interlace mode for a vdata. interlace can be 'full' or 'no'.
'setname'status = hdfvs('setname',vdata_id,name)Assigns a name to a vdata.
'write'count = hdfvs('write', vdata_id, data)Writes to a vdata. data must be an nfields-by-1 cell array. Each cell must contain an order(i)-by-n vector of data where order(i) is the number of scalar values in each field. The types of the data must match the field types set via hdfvs('setfields') or the fields in an already existing vdata.
'read'[data,count] = hdfvs('read',vdata_id,n)Reads from a vdata. Data is returned in a nfields-by-1 cell array. Each cell contains a order(i)-by-n vector of data where order is the number of scalar values in each field. The fields are returned in the same order as specified in hdfvs('setfields',...).
'seek'pos = hdfvs('seek',vdata_id,record)Seeks to a specified record in a vdata.
'setattr'status = hdfvs('setattr',vdata_id,field_index,name,A)Sets the attribute of a vdata field or vdata.
'setexternalfile'status = hdfvs('setexternalfile',vdata_id,filename,offset)Stores vdata information in an external file.
'getattr'[value,status] = hdfvs('getattr',vdata_id,field_index,attr_index)Reads the value of an attribute attached to a vdata or a vdata field. Set field_index to 'vdata' to retrieve an attribute attached to the field itself. Set field_index to the numerical index of the field to retrieve an attribute attached to a vdata field.
'setattr'status = hdfvs('setattr',vdata_id,field_index,name,A)Sets the attribute of a vdata field or vdata.field_index can be an index number or 'vdata'.

File Inquiry Functions

File inquiry functions provide information about how vdatas are stored in a file. They are useful for locating vdatas in a file.

Value of funcstrFunction SyntaxDescription
'find'vdata_ref = hdfvs('find',file_id,vdata_name)Searches for a given vdata name in the specified HDF file.
'findclass'vdata_ref = hdfvs('findclass',file_id,vdata_class)Returns the reference number of the first vdata corresponding to the specified vdata class.
'getid'next_ref = hdfvs('getid',file_id,vdata_ref)Returns the identifier of the next vdata in the file.
'lone'[refs,count] = hdfvs('lone',file_id,maxsize)Returns the reference numbers of the vdatas that are not linked into vgroups.

Vdata Inquiry Functions

Vdata inquiry functions provide specific information about a given vdata, including the vdata's name, class, number of fields, number of records, tag and reference pairs, interlace mode, and size.

Value of funcstrFunction SyntaxDescription
'fexist'status = hdfvs('fexist',vdata_id,fields)Tests for the existence of fields in the specified vdata.
'inquire'[n,interlace,fields,nbytes,vdata_name,status] = ... hdfvs('inquire',vdata_id)Returns information about the specified vdata.
'elts'count = hdfvs('elts',vdata_id)Returns the number of records in the specified vdata.
'getclass'[class_name,status] = hdfvs('getclass',vdata_id)Returns the HDF class of the specified vdata.
'getfields'[field_names,count] = hdfvs('getfields',vdata_id)Returns all field names within the specified vdata.
'getinterlace'[interlace,status] = hdfvs('getinterlace',vdata_id)Retrieves the interlace mode of the specified vdata.
'getname'[vdata_name,status] = hdfvs('getname',vdata_id)Retrieves the name of the specified vdata.
'getversion'version = hdfvs('getversion',vdata_id)Returns the version number of a vdata.
'sizeof'nbytes = hdfvs('sizeof',vdata_id,fields)Returns the fields sizes of the specified vdata.
'Queryfields'[fields,status] = hdfvs('Queryfields',vdata_id)Returns the field names of the specified vdata.
'Queryname'[name,status] = hdfvs('Queryname',vdata_id)Returns the name of the specified vdata.
'Queryref'ref = hdfvs('Queryref',vdata_id)Retrieves the reference number of the specified vdata.
'Querytag'tag = hdfvs('Querytag',vdata_id)Retrieves the tag of the specified vdata.
'Querycount'[count,status] = hdfvs('Querycount',vdata_id)Returns the number of records in the specified vdata.
'Queryinterlace'[interlace,status] = hdfvs('Queryinterlace',vdata_id)Returns the interlace mode of the specified vdata.
'Queryvsize'vsize = hdfvs('Queryvsize',vdata_id)Retrieves the local size in bytes of the specified vdata record.
'findex'[field_index,status] = hdfvs('findex',vdata_id,fieldname)Queries the index of a vdata field given the field name.
'nattrs'count = hdfvs('nattrs',vdata_id)Returns the number of attributes of the specified vdata and the vdata fields contained in it.
'fnattrs'count = hdfvs('fnattrs',vdata_id,field_index)Queries the total number of vdata attributes.
'findattr'attr_index = hdfvs('findattr',vdata_id,field_index,attr_name)Retrieves the index of an attribute given the attribute name.
'isattr'tf = hdfvs('isattr',vdata_id)Determines if the given vdata is an attribute.
'attrinfo'[name,data_type,count,nbytes,status] = hdfvs('attrinfo',... vdata_id,field_index,attr_index)Returns the name, data type, number of values, and the size of the values of the specified attributes of the specified vdata field or vdata.

Output Arguments

A status or identifier output of -1 indicates that the operation failed.

Version History

Introduced before R2006a