0001
0002
0003 replaceopts = repmat({[]},size(wavestructids));
0004
0005 newwavestructids = cell(0,1);
0006 newwavestructsstatus = zeros(0,ntimes);
0007 newwavestructss = cell(0,ntimes);
0008
0009 nt = length(flag_shotimes);
0010 for it = 1:nt,
0011 for iw = 1:length(launchs{it});
0012
0013 wavestruct = imake_wavestructs_jd(equils{flag_shotimes(it)},launchs{it}{iw});
0014
0015 isel = find(strcmp(wavestruct.id,wavestructids));
0016 if isempty(isel),
0017
0018 status.data = 2;
0019
0020 newisel = find(strcmp(wavestruct.id,newwavestructids));
0021 if isempty(newisel),
0022 newwavestructids{end+1,1} = wavestruct.id;
0023
0024 newwavestructsstatus(end+1,:) = zeros(1,ntimes);
0025 newwavestructss(end+1,:) = cell(1,ntimes);
0026
0027 newwavestructsstatus(end,flag_shotimes(it)) = 1;
0028 newwavestructss{end,flag_shotimes(it)} = wavestruct;
0029 else
0030 if newwavestructsstatus(newisel,flag_shotimes(it)) == 1,
0031 disp(['Warning : replacing an existing new wavestructs with id ',wavestruct.id])
0032 end
0033 newwavestructsstatus(newisel,flag_shotimes(it)) = 1;
0034 newwavestructss{newisel,flag_shotimes(it)} = wavestruct;
0035 end
0036
0037 else
0038
0039 if isempty(replaceopts{isel})
0040
0041 replaceopt = iselect_jd({...
0042 'Discard new wavestruct',...
0043 'Fill or replace existing wavestructss cell',...
0044 'Modify new wavestruct id'},...
0045 ['The wavestruct id ',wavestruct.id,' is already referenced :'],lukeobj.infopanel.handle,style.buttonselectstyle,3,'buttongroup');
0046
0047 if replaceopt == 2,
0048
0049 status.data = 2;
0050
0051 wavestructss{isel,flag_shotimes(it)} = wavestruct;
0052 status.wavestructs(isel,flag_shotimes(it)) = 1;
0053 elseif replaceopt == 3,
0054
0055 status.data = 2;
0056
0057 while any(strcmp(wavestruct.id,wavestructids)),
0058 wavestruct.id = iselect_jd({},'New wavestruct id : ',lukeobj.infopanel.handle,style.editselectstyle,wavestruct.id,'edit');
0059 end
0060 newwavestructids{end+1} = wavestruct.id;
0061
0062 newwavestructsstatus(end+1,:) = zeros(1,ntimes);
0063 newwavestructss(end+1,:) = cell(1,ntimes);
0064
0065 newwavestructsstatus(end,flag_shotimes(it)) = 1;
0066 newwavestructss{end,flag_shotimes(it)} = wavestruct;
0067 end
0068
0069 if nt > 1,
0070
0071 allopt = iselect_jd({'Yes','No'},'Apply to all times ?',lukeobj.infopanel.handle,style.buttonselectstyle,1,'buttongroup');
0072
0073 if allopt == 1,
0074
0075 if replaceopt == 1,
0076 replaceopts{isel} = false;
0077 elseif replaceopt == 2,
0078 replaceopts{isel} = true;
0079 else
0080 replaceopts{isel} = wavestruct.id;
0081 end
0082 end
0083
0084 clear allopt
0085
0086 end
0087
0088 clear replaceopt
0089
0090 elseif islogical(replaceopts{isel}) && replaceopts{isel},
0091
0092 status.data = 2;
0093
0094 wavestructss{isel,flag_shotimes(it)} = wavestruct;
0095 status.wavestructs(isel,flag_shotimes(it)) = 1;
0096
0097 elseif ischar(replaceopts{isel}),
0098
0099 status.data = 2;
0100
0101 wavestruct.id = replaceopts{isel};
0102 newisel = find(strcmp(wavestruct.id,newwavestructids));
0103 newwavestructss{newisel,flag_shotimes(it)} = wavestruct;
0104 newwavestructsstatus(newisel,flag_shotimes(it)) = 1;
0105 end
0106 end
0107 end
0108 end
0109
0110 wavestructids = [wavestructids;newwavestructids];
0111 status.wavestructs = [status.wavestructs;newwavestructsstatus];
0112 wavestructss = [wavestructss;newwavestructss];
0113
0114 clear replaceopts wavestruct newwavestructids newwavestructsstatus newwavestructss it nt iw isel newisel