Skip to content
Snippets Groups Projects
initParameterChoice.m 1.98 KiB
Newer Older
function error = initParameterChoice( hMainFig, pmhPara )
%
% Initialise the 3 popup menu used to choose the parameters that will be
% plot on figure 1, 2 and 3


% Get the tsg structure
% ---------------------
tsg = getappdata( hMainFig, 'tsg_data');

% Initialisation du popup n1
% ---------------------------
if isfield( tsg, 'SSPS' )
  pop1 = { 'SSPS' };
end
if isfield( tsg, 'SSJT' )
  pop1 = [ pop1 {'SSJT'} ];
end
if isfield( tsg, 'SSTP' )
  pop1 = [ pop1 {'SSTP'} ];
end

set( pmhPara(1), 'String', pop1, 'Value', 1 );

% Initialisation du popup n2 - Same as pop1
% ------------------------------------------
pop2 = pop1;
set( pmhPara(2), 'String', pop2, 'Value', 2 );

% Initialisation du popup n3
% ---------------------------
if isfield( tsg, 'SPDC' )
  pop3 = { 'SPDC' };
end
if isfield( tsg, 'CNDC' )
  pop3 = [ pop3 {'CNDC'} ];
end
if isfield( tsg, 'LATX' )
  pop3 = [ pop3 {'LATX'} ];
end
if isfield( tsg, 'LONX' )
  pop3 = [ pop3 {'LONX'} ];
end
if isfield( tsg, 'SSPS' )
  pop3 = [ pop3 {'SSPS'} ];
end
if isfield( tsg, 'SSJT' )
  pop3 = [ pop3 {'SSJT'} ];
end
if isfield( tsg, 'SSTP' )
  pop3 = [ pop3 {'SSTP'} ];
end

set( pmhPara(3), 'String', pop3, 'Value', 1 );
jacques.grelet_ird.fr's avatar
jacques.grelet_ird.fr committed
% Initialise tsg.plot.parameter
% -----------------------------------
if ~isempty( pop1{1} )
jacques.grelet_ird.fr's avatar
jacques.grelet_ird.fr committed
  tsg.plot.parameter{1} = pop1{1};
jacques.grelet_ird.fr's avatar
jacques.grelet_ird.fr committed
  tsg.plot.parameter{1} = 'NONE';
end

if ~isempty( pop2{2} )
jacques.grelet_ird.fr's avatar
jacques.grelet_ird.fr committed
  tsg.plot.parameter{2} = pop2{2};
jacques.grelet_ird.fr's avatar
jacques.grelet_ird.fr committed
  tsg.plot.parameter{2} = 'NONE';
if ~isempty( pop3{1} )
jacques.grelet_ird.fr's avatar
jacques.grelet_ird.fr committed
  tsg.plot.parameter{3} = pop3{1};
jacques.grelet_ird.fr's avatar
jacques.grelet_ird.fr committed
  tsg.plot.parameter{3} = 'NONE';
jacques.grelet_ird.fr's avatar
jacques.grelet_ird.fr committed
% Initialise tsg.plot.sample
% We need this variable because the validation of SSJT can only be
% made with SSTP sample. 
% ----------------------------------------------------------------
jacques.grelet_ird.fr's avatar
jacques.grelet_ird.fr committed
tsg.plot.sample = pop1{1};
if strcmp( tsg.plot.sample, 'SSJT' )
  tsg.plot.sample = 'SSTP';
% Save the tsg structure
% ---------------------
setappdata( hMainFig, 'tsg_data', tsg);

end