function updateTsgStructWithCalCoeff(hMainFig) % % This function is called after change option/parameter calibrations coeff % type or when initialize tsgStruct % % Input % ----- % hMainFig ............ Handle to the main user interface % % $Id$ % Get the data from the application GUI % ------------------------------------- tsg = getappdata( hMainFig, 'tsg_data'); % define coefficients variables % ----------------------------- var = {'SSJT_CALCOEF', 'CNDC_CALCOEF', 'SSTP_CALCOEF'}; % define coefficients names % ------------------------- coeff_type = {{'DATE','A','B','C','D','F0',''},{'DATE','A','B','C','D','M','CPCOR'},... {'DATE','A','B','C','D','F0',''}; ... {'DATE','G','H','I','J','F0',''},{'DATE','G','H','I','J','CTCOR','CPCOR'},... {'DATE','G','H','I','J','F0',''}}; % get preference choice for cabrations type popup % ----------------------------------------------- pref = tsg.preference.coeff_type_value; % dynamically fill variables % -------------------------- for i = 1:numel(var) if isempty(tsg.(var{i})) for j = 1:tsg.dim.CALCOEF tsg.(var{i})(j) = NaN; tsg.([var{i} '_CONV']) = ... [tsg.([var{i} '_CONV']); padding(coeff_type{pref,i}{j}, tsg.dim.COEF_CONV_SIZE)]; end elseif isnan(tsg.(var{i})) tsg.([var{i} '_CONV']) = []; for j = 1:tsg.dim.CALCOEF tsg.(var{i})(j) = NaN; tsg.([var{i} '_CONV']) = ... [tsg.([var{i} '_CONV']); padding(coeff_type{pref,i}{j}, tsg.dim.COEF_CONV_SIZE)]; end end end % Save tsg structure % ------------------ setappdata( hMainFig, 'tsg_data', tsg); end