Last change
on this file since 1134 was
1013,
checked in by g7moreau, 7 years ago
|
- Remove property svn:executable
|
File size:
889 bytes
|
Rev | Line | |
---|
[947] | 1 | % hdf5save.m |
---|
| 2 | % |
---|
| 3 | % hdf5save('filename','name in workspace','name in hdf5 file',...) |
---|
| 4 | % |
---|
| 5 | % Save the given variables in an hdf5 file. Syntax Similar to the native |
---|
| 6 | % matlab save command. Can save strings, arrays, and structs. |
---|
| 7 | % |
---|
| 8 | |
---|
| 9 | % Author: Gael Varoquaux <gael.varoquaux@normalesup.org> |
---|
| 10 | % Copyright: Gael Varoquaux |
---|
| 11 | % License: BSD-like |
---|
| 12 | |
---|
| 13 | function hdf5save(filename,varargin) |
---|
| 14 | |
---|
[1013] | 15 | % this is just a wrapper function that calls a recursive function that |
---|
| 16 | % will save recursively structs. |
---|
[947] | 17 | |
---|
[1013] | 18 | nvars=size(varargin,2)/2; |
---|
[947] | 19 | |
---|
[1013] | 20 | if nvars~=floor(nvars); |
---|
| 21 | error('expecting a name for each variable'); |
---|
| 22 | end |
---|
[947] | 23 | |
---|
[1013] | 24 | % Assign variables to save in workspace so as to be able to get them back |
---|
| 25 | % with recursive fonctions. |
---|
| 26 | for i=[1:nvars] |
---|
| 27 | str=varargin{2*i}; |
---|
| 28 | var=evalin('caller',str); |
---|
| 29 | assignin('base',str,var); |
---|
| 30 | end |
---|
| 31 | |
---|
| 32 | hdf5save_recursion(filename,'',1,varargin) |
---|
[947] | 33 | end |
---|
Note: See
TracBrowser
for help on using the repository browser.