Contents     Functions         Previous Next     PDF Index

v_handle, sdthdf


Class constructor for variable handle objects.


The Structural Dynamics Toolbox supports variable handle objects, which act as pointers to variables that are actually stored as global variables, user data of graphical objects, or in files. This latter application may become very useful when handling very large models. sdthdfindeed allows RAM unloading by keeping data on drive while using a pointed to it. A trade-off between data access performance (limited to your drive I/O performance) and amount of free memory will occur.

Some supported file formats are MATLAB 6 .mat files, MATLAB >7.3 HDF based .mat files, NASTRAN .op2, ABAQUS .fil ...

v_handle objects are used to

v_handle objects essentially behave like global variables with the notable exception that a clear command only deletes the handle and not the pointed data.

Only advanced programmers should really need access to the internal structure of v_handle.

hdf Commands

The new hdf5 file format, supported by MATLAB since version 7.3, allows very efficient data access from files. Partial loading is possible, as well as data location by pointers. sdthdfallows the user to unload RAM by saving specific data to dedicated files, and to optimize file loading using pointers. To be able to use these functionalities, the file must have been saved in hdf5 format, which is activated in MATLAB using the -v7.3 option of the save function.

The following commands are supported.


This command handles partial data loading, depending on the level specified by the user.

For unloaded data, a v_handlepointer respecting the data structure and names is generated, so that the access is preserved. Further hdfreadref application to this specific data can be done later.

By default, the full file is loaded. Command option -level allows specifying the desired loading level. For structured data, layers are organized in which substructures are leveled. This command allows data loading until a given layer. Most common levels used are given in the folling list

It takes in argument either a file, or a data structure containing hdf5 v_handlepointers. In the case where a file is specified, the user can precise the data to be loaded, by giving its named preceded by a slash /, substructure names can also be specified giving the name path to the variable to be loaded with a succession of slashes.

% To load an hdf5 file
% To load it using \vhandle pointers
% To load a specified variable
% To load a specified sub data
% To load a subdata from a previously loaded pointer


This command handles partial data saving to a temporary file. It is designed to unload large numerical data, such as sparse matrices, or deformation fields. Command option -struct however allows to save more complex data structures.

The function takes in argument the data to save and a structure with a field Dbfile containing the temporary file path (string). The function outputs the v_handleto the saved data. The v_handlehas the same data structure than the original. The v_handledata can be recovered by hdfreadref.



This command handles similar saving strategy than hdfdbsave but is designed to integrate feplotmodels in hdf5 format. The file linked to the model is not supposed to be temporary, and data names are linked to an SDT model data structure, which are typically in the model stack. The variable data names, must be of format field_name to store model.field in hdf5 format.

For model stack entries, the name must be of the type Stack_type_name to store cf.Stack'type','name'.

The function takes in argument the data base file, the feplot handle and the data name, which will be interpreted to be found in the feplotmodel. The data will be replaced by v_handlepointers in the feplotmodel. Data can be reloaded with command hdfmodel



This command loads v_handledata pointers in the feplotmodel at locations where hdf5 data have been saved. This command works from the hdf file side, and loads all the data contained with standard names in the feplotmodel. See hdfmodelsave for more information on the standard data names. Commando option -check only loads the data contained in the hdf file that is already instanced in the feplotmodel.



Handling hdf5 files in data structures can become very complex when multiple handles are generated in multiple data. This command thus aims to force a file to be closed.


A lower level closing call allows clearing the hdf5 librairies, when needed,



Here is an example of offload to HDF5 based mat files, and how to access the data afterwards.

cf.mdl=fe_case(cf.mdl,'assemble -matdes 2 1 NoT -SE');
cf.Stack{'curve','defR'}=fe_eig(cf.mdl,[5 50 1e3]);

% save(off-load) some stack entries to a file
% save model but not the off-loaded entries

cf=fecom('load',fname2); % reload the model
sdthdf('hdfmodel',fname,cf); % reload pointers to the entries

For MATLAB >7.3 HDF based .mat files, you can open a v_handle pointer to a variable in the file using

var=sdthdf('hdfreadref -level0',fname,'Stack_curve_defR')

See also

SDT handle

©1991-2011 by SDTools
Previous Up Next