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

slope and offset not agree

replace
PARA = [ 'CNDC'; 'SSJT'; 'SSTP' ];
with cell array of char
PARA =  {'CNDC', 'SSJT', 'SSTP'};
and modify following code 
parent d48cdc8d
No related branches found
No related tags found
No related merge requests found
...@@ -22,27 +22,38 @@ tsg = getappdata( hMainFig, 'tsg_data' ); ...@@ -22,27 +22,38 @@ tsg = getappdata( hMainFig, 'tsg_data' );
% Variables % Variables
% --------- % ---------
PARA = [ 'CNDC'; 'SSJT'; 'SSTP' ]; PARA = {'CNDC', 'SSJT', 'SSTP'};
for i = 1:3 for i = PARA
if ~isempty( tsg.(PARA(i,:)) ) % convert cell to char
% --------------------
ip = char(i);
if ~isempty( tsg.(ip) )
para1 = [PARA(i,:) '_LINCOEF_NEW']; para1 = strcat(ip, '_LINCOEF_NEW');
para2 = [PARA(i,:) '_CAL']; para2 = strcat(ip, '_CAL');
key = strcat(ip, '_LINCOEF_CONV');
% get indice off slope and offset
% -------------------------------
slope = strmatch('SLOPE', tsg.(key));
offset = strmatch('OFFSET', tsg.(key));
% If the Slope = 1 and the offset = 0 : No calibration % If the Slope = 1 and the offset = 0 : No calibration
% The variable _CAL must be emptied % The variable _CAL must be emptied
% --------------------------------------------------------------------- % ---------------------------------------------------------------------
if abs(1-tsg.(para1)(1)) > .00000001 || abs(0-tsg.(para1)(2)) > .00000001 if abs(1-tsg.(para1)(slope)) > .00000001 || ...
tsg.(para2) = tsg.(para1)(1) * tsg.(PARA(i,:)) + tsg.(para1)(2); abs(0-tsg.(para1)(offset)) > .00000001
tsg.(para2) = tsg.(para1)(slope) * tsg.(ip) + tsg.(para1)(offset);
else else
tsg.(para2) = []; tsg.(para2) = [];
end end
elseif strcmp( PARA(i,:), 'CNDC' ) || strcmp( PARA(i,:), 'SSJT' ) elseif strcmp( ip, 'CNDC' ) || strcmp( ip, 'SSJT' )
msgbox( [ ' No ' PARA(i,:) ' data'],... msgbox( [ ' No ' ip ' data'],...
'Function ''Calibration''',... 'Function ''Calibration''',...
'warn', 'modal'); 'warn', 'modal');
return return
......
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