source: trunk/src/hdf5save.m @ 997

Last change on this file since 997 was 947, checked in by sommeria, 9 years ago

read hf5 added

  • Property svn:executable set to *
File size: 832 bytes
Line 
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
13function hdf5save(filename,varargin)
14
15% this is just a wrapper function that calls a recursive function that
16% will save recursively structs.
17
18nvars=size(varargin,2)/2;
19
20if nvars~=floor(nvars) ;
21    error('expecting a name for each variable') ;
22end
23
24%  Assign variables to save in workspace so as to be able to get them back
25%  with recursive fonctions.
26for i=[1:nvars]
27    str=varargin{2*i};
28    var=evalin('caller',str);
29    assignin('base',str,var);
30end
31
32hdf5save_recursion(filename,'',1,varargin)
33
Note: See TracBrowser for help on using the repository browser.