source: trunk/src/hdf5save.m @ 1064

Last change on this file since 1064 was 1013, checked in by g7moreau, 4 years ago
  • Remove property svn:executable
File size: 889 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
18    nvars=size(varargin,2)/2;
19
20    if nvars~=floor(nvars);
21        error('expecting a name for each variable');
22    end
23
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)
33end
Note: See TracBrowser for help on using the repository browser.