0001 function equil = iluke_equilcorr(equil)
0002
0003 if ~isfield(equil,'tokamak') || ~isfield(equil,'shotnum') || ~isfield(equil,'shotime')
0004
0005
0006
0007 equil.tokamak = 'UNKNOWN';
0008 equil.shotnum = '0';
0009 equil.shotime = 0;
0010
0011 isep = [0,find(equil.id == '_'),length(equil.id)+1];
0012 nstrs = length(isep) - 1;
0013 strs = cell(1,nstrs);
0014
0015 for iisep = 1:nstrs,
0016 strs{iisep} = equil.id(isep(iisep)+1:isep(iisep+1)-1);
0017 end
0018
0019 inum = find(~isnan(str2double(strs)));
0020 nnum = length(inum);
0021
0022 if nnum > 0,
0023
0024 equil.shotnum = strs{inum(1)};
0025
0026 if inum(1) > 1,
0027 equil.tokamak = strs{1};
0028 for iisep = 2:inum(1)-1,
0029 equil.tokamak = [equil.tokamak,'_',strs{iisep}];
0030 end
0031 end
0032
0033 end
0034
0035 if nnum > 1,
0036
0037 equil.shotime = str2double(strs{inum(2)});
0038
0039 end
0040 elseif ischar(equil.shotime),
0041 equil.shotime = str2double(equil.shotime);
0042 end
0043
0044 if ~isfield(equil,'ip'),
0045 equil.ip = NaN;
0046 end