Changeset 27255
- Timestamp:
- 08/31/22 15:45:12 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/branches/trunk-larour-SLPS2022/src/m/classes/organizer.m
r25758 r27255 134 134 error(['Could not find ' path ]); 135 135 end%}}} 136 function loaddata(org,string ),% {{{136 function loaddata(org,string,varargin),% {{{ 137 137 138 138 %Get model path 139 139 if ~ischar(string), error('argument provided is not a string'); end 140 140 path=[org.repository '/' org.prefix string]; 141 142 %any extra options? 143 if nargin==3, 144 datas=varargin{:}; 145 else 146 datas=cell(0); 147 end 148 if ~isa(datas,'char') & ~isa(datas,'cell'), 149 error('loaddata error message: extra parameters should either be a string or cell array of string'); 150 end 151 if isa(datas,'char'), 152 datas={datas}; 153 end 141 154 142 155 %figure out if the data is there, otherwise, we have to use the default path supplied by user. … … 149 162 end 150 163 if exist(path,'file') 151 evalin('caller',['load -mat ' path]); 164 if ~numel(datas), 165 string=sprintf('load(''%s'',''-mat'');',path); 166 else 167 string=sprintf('load(''%s'',''-mat'',',path); 168 for i=1:numel(datas)-1, 169 datai=datas{i}; 170 string=sprintf('%s''%s'',',string,datai); 171 end 172 datai=datas{end}; 173 string=sprintf('%s''%s'');',string,datai); 174 end 175 evalin('caller',string); 152 176 return; 153 177 end
Note:
See TracChangeset
for help on using the changeset viewer.