Skip to content
Snippets Groups Projects
Commit a6db4637 authored by jacques.grelet_ird.fr's avatar jacques.grelet_ird.fr
Browse files

add 2 tests ~isempty(tsg.SSJT_CALCOEF) that prevent error when var_CALCOEF are...

add 2 tests ~isempty(tsg.SSJT_CALCOEF) that prevent error when var_CALCOEF are not present: .tsgqc file for example
parent 09bf5d29
No related branches found
No related tags found
No related merge requests found
......@@ -197,7 +197,9 @@ add_variables;
% additinnal coefficient variable here
% ------------------------------------
add_coefficients;
if ~isempty(tsg.SSJT_CALCOEF)
add_coefficients;
end
% set a callback to PLATFORM_NAME uicontrol
% -----------------------------------------
......@@ -333,25 +335,28 @@ uiwait(hHeaderFig);
% get additional coefficients from uicontrol and update tsg struct
% ----------------------------------------------------------------
for kk = add_coeff_var
var = char(kk);
for ii=1:numel(tsg.(var))
key = strtrim(tsg.([var '_CONV'])(ii,:));
if strcmpi(key, '')
continue
if ~isempty(tsg.SSJT_CALCOEF)
for kk = add_coeff_var
var = char(kk);
for ii=1:numel(tsg.(var))
key = strtrim(tsg.([var '_CONV'])(ii,:));
if strcmpi(key, '')
continue
end
s = get(data.(strcat(var,'_',key)), 'string');
%tsg.(var)(i) = single(str2double(get(data.(strcat(var,'_',key)), 'string')));
if strcmpi(key, 'DATE')
tsg.(var)(ii) = single(datenumToJulian(datenum(s, 'dd/mm/yyyy')));
else
tsg.(var)(ii) = single(str2double(s));
end
%p_i.(key) = tsg.(key);
end
s = get(data.(strcat(var,'_',key)), 'string');
%tsg.(var)(i) = single(str2double(get(data.(strcat(var,'_',key)), 'string')));
if strcmpi(key, 'DATE')
tsg.(var)(ii) = single(datenumToJulian(datenum(s, 'dd/mm/yyyy')));
else
tsg.(var)(ii) = single(str2double(s));
end
%p_i.(key) = tsg.(key);
end
end
end
% Save tsg structure
% ------------------
setappdata(hTsgGUI, 'tsg_data', tsg);
......@@ -569,8 +574,8 @@ uiwait(hHeaderFig);
% get key from cell array of keys
% ------------------------------
var = char(acv);
var = char(acv);
% check before use, if variable has the right fixed dimensions
% if not, write fillValue (NaN or char filled with blanks)
% ------------------------------------------------------------
......@@ -584,14 +589,14 @@ uiwait(hHeaderFig);
% -------------------------------------------
for ii=1:numel(tsg.(var))
cle = tsg.([var '_CONV'])(ii,:);
cle = tsg.([var '_CONV'])(ii,:);
% if fillValue, don't display uicontrol
% -------------------------------------
if strcmp(cle, padding('', tsg.dim.CALCOEF_CONV))
continue
end
% if key is date, use special format, not real
% --------------------------------------------
if strcmpi(cle, padding('DATE', tsg.dim.CALCOEF_CONV))
......@@ -599,7 +604,7 @@ uiwait(hHeaderFig);
else
value = num2str(tsg.(var)(ii));
end
% concate variable name with key: eg SSJT_CALCOEF_H
% -------------------------------------------------
cle = strcat(var, '_', cle);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment