Last change
on this file since 151 was
142,
checked in by bduin, 5 years ago
|
Updated collection of datasets
|
File size:
953 bytes
|
Rev | Line | |
---|
[137] | 1 | %PR_SAVEMATFILE Save matfile(s) for calling mfile
|
---|
| 2 |
|
---|
| 3 | function varargout = pr_savematfile(varargin)
|
---|
| 4 | % nout: number of outputs of calling function
|
---|
| 5 | % nout = 1: combine all files into varargout{1}
|
---|
| 6 | % nout > 1: return separate files unchanged
|
---|
| 7 | % For any nout, all combined and single datasets are stored
|
---|
| 8 |
|
---|
| 9 | name = pr_callername;
|
---|
| 10 | matfile = fullfile(fullfile(fileparts(which(name)),'data'),name);
|
---|
| 11 |
|
---|
| 12 | varargout = cell(1,nargout);
|
---|
| 13 | if nargin == 1
|
---|
| 14 | a = varargin{1};
|
---|
| 15 | save(matfile,'a');
|
---|
| 16 | varargout{1} = a;
|
---|
| 17 | else
|
---|
| 18 | if nargout == 1
|
---|
| 19 | a = vertcat(varargin{:});
|
---|
| 20 | save(matfile,'a');
|
---|
| 21 | varargout{1} = a;
|
---|
| 22 | for i=1:nargin
|
---|
| 23 | a = varargin{i};
|
---|
| 24 | save([matfile '_' num2str(i)],'a');
|
---|
| 25 | end
|
---|
| 26 | else
|
---|
| 27 | a = vertcat(varargin{:});
|
---|
| 28 | save(matfile,'a');
|
---|
| 29 | for i=1:nargin
|
---|
| 30 | a = varargin{i};
|
---|
| 31 | save([matfile '_' num2str(i)],'a');
|
---|
| 32 | end
|
---|
| 33 | for i=1:nargout
|
---|
| 34 | varargout{i} = varargin{i};
|
---|
| 35 | end
|
---|
| 36 | end
|
---|
| 37 | end
|
---|
Note: See
TracBrowser
for help on using the repository browser.