From 049872ee6ea57e63cd028b6757095a982b0c2257 Mon Sep 17 00:00:00 2001 From: Jacques Grelet <jacques.grelet@ird.fr> Date: Tue, 3 Mar 2009 16:23:49 +0000 Subject: [PATCH] ajout de tsg_util/updateTsgStructWithCalCoeff.m --- tsg_util/updateTsgStructWithCalCoeff.m | 55 ++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 tsg_util/updateTsgStructWithCalCoeff.m diff --git a/tsg_util/updateTsgStructWithCalCoeff.m b/tsg_util/updateTsgStructWithCalCoeff.m new file mode 100644 index 0000000..4b5f6d0 --- /dev/null +++ b/tsg_util/updateTsgStructWithCalCoeff.m @@ -0,0 +1,55 @@ +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 \ No newline at end of file -- GitLab