isave_struct_jd

PURPOSE ^

SYNOPSIS ^

function [spath,sfile] = isave_struct_jd(s,sname,sbase,sid,workdir,opt_gui)

DESCRIPTION ^

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [spath,sfile] = isave_struct_jd(s,sname,sbase,sid,workdir,opt_gui)
0002 %
0003 if nargin < 6,
0004     opt_gui = 1;
0005 end
0006 if nargin < 5,
0007     workdir = pwd;
0008 end
0009 if nargin < 5,
0010     sid = '';
0011 end
0012 if nargin < 3,
0013     sbase = '';
0014 end
0015 if nargin < 2,
0016     error('No structure name specified');
0017 end
0018 %
0019 if isempty(sbase),
0020     filestr = '*.mat';
0021 else
0022     filestr = [sbase,'_*.mat'];
0023 end
0024 %
0025 sfile = '';
0026 spath = '';
0027 %
0028 s_opt = input_dke_yp(['Do you want to save the structure ''',sname,''' separately (y/n)'],'n',{'y','n'});
0029 if strcmp(s_opt,'y'),
0030     sd = pwd;
0031     cd(workdir);
0032     %
0033     if ~isempty(sbase) && ~isempty(sid),
0034         filename = [sbase,'_',sid,'.mat'];
0035     elseif ~isempty(sbase) && isempty(sid),
0036         filename = [sbase,'.mat'];
0037     elseif isempty(sbase) && ~isempty(sid),
0038         filename = [sid,'.mat'];
0039     else
0040         filename = '';
0041     end
0042     %
0043     [filename,pathname] = iputfile_jd(opt_gui,filestr,['Please provide the ',sbase,' file name'],filename);
0044     %
0045     if filename == 0,
0046         disp(['-----> No file name specified, ''',sname,''' structure not saved.'])
0047     else
0048         %
0049         eval([sname,' = s;'])
0050         save([pathname,filename],sname);
0051         disp(['-----> The structure ''',sname,''' is saved in file ',pathname,filename])
0052         %
0053         sfile = filename;
0054         spath = pathname;
0055     end  
0056     cd(sd);
0057 end

Community support and wiki are available on Redmine. Last update: 18-Apr-2019.