forked from spm/spm12
-
Notifications
You must be signed in to change notification settings - Fork 0
/
save.m
25 lines (23 loc) · 815 Bytes
/
save.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
function this = save(this)
% Save an meeg object into a file
% FORMAT this = save(this)
%
% Converts an meeg object to struct and saves it.
%__________________________________________________________________________
% Copyright (C) 2008-2019 Wellcome Trust Centre for Neuroimaging
% Vladimir Litvak
% $Id: save.m 7619 2019-06-19 14:13:18Z guillaume $
D = struct(this);
try
save(fullfile(this), 'D', spm_get_defaults('mat.format'));
catch
err = lasterror;
if strcmp(err.identifier, 'MATLAB:MatFile:UnsupportedCharacters')
warning('MATLAB:MatFile:UnsupportedCharacters',...
['Found characters the default encoding is unable to represent.\n',...
'Trying again using default version for MAT-files.']);
save(fullfile(this), 'D');
else
rethrow(err);
end
end