wolffd@0: function a = subsasgn(a,index,val) wolffd@0: % SUBSASGN Define index assignment for mirstruct objects wolffd@0: switch index(1).type wolffd@0: case '.' wolffd@0: if strcmpi(index(1).subs,'tmp') wolffd@0: fields = a.fields; wolffd@0: data = a.data; wolffd@0: wolffd@0: if isa(val,'mirdata') || (iscell(val) && isa(val{1},'mirdata')) wolffd@0: % If the 'tmp' data turns to be an actual evaluated data, wolffd@0: % the mirstruct object is transformed into a simple struct. wolffd@0: a = struct; wolffd@0: for i = 1:length(fields) wolffd@0: a.(fields{i}) = data{i}; wolffd@0: end wolffd@0: a.tmp.(index(2).subs) = val; wolffd@0: return wolffd@0: end wolffd@0: wolffd@0: if isa(val,'mirdesign') wolffd@0: val = set(val,'Stored',{index.subs}); wolffd@0: end wolffd@0: if length(index)>2 wolffd@0: if strcmpi(index(3).type,'{}') wolffd@0: isubs = index(3).subs; wolffd@0: if length(isubs)>1 wolffd@0: a.tmp.(index(2).subs){isubs{1},isubs{2}} = val; wolffd@0: else wolffd@0: a.tmp.(index(2).subs){isubs{1}} = val; wolffd@0: end wolffd@0: end wolffd@0: else wolffd@0: a.tmp.(index(2).subs) = val; wolffd@0: end wolffd@0: aa = struct; wolffd@0: aa.fields = fields; wolffd@0: aa.data = data; wolffd@0: aa.tmp = a.tmp; wolffd@0: aa.stat = a.stat; wolffd@0: a = class(aa,'mirstruct',val); wolffd@0: return wolffd@0: end wolffd@0: [is,id] = ismember(index(1).subs,a.fields); wolffd@0: if not(is) wolffd@0: a.fields{end+1} = index(1).subs; wolffd@0: a.data{end+1} = []; wolffd@0: id = length(a.fields); wolffd@0: end wolffd@0: if length(index) == 1 wolffd@0: a.data{id} = val; wolffd@0: else wolffd@0: a.data{id} = subsasgn(a.data{id},index(2:end),val); wolffd@0: end wolffd@0: if get(val,'NoChunk') && isframed(a) wolffd@0: a = set(a,'FrameDontChunk',1); wolffd@0: % Frame-decomposed flowchart where one dependent variable requires wolffd@0: % a complete computation. Should not therefore be evaluated wolffd@0: % chunk after chunk. wolffd@0: end wolffd@0: end