function updateAdjustedVariable( hMainFig ) % % Update adjusted SSPS and SSJT arrays once calibration has been % applied to these variable. % % The TRICK : % The programe test the variable ADJUSTED_ERROR as only records corrected % compared to water sample get error values % % Get tsg application data % ------------------------ tsg = getappdata( hMainFig, 'tsg_data' ); % Get VALUE_CHANGED % ------------------------------------------------------- VALUE_CHANGED = get(tsg.qc.hash, 'VALUE_CHANGED', 'code'); % SSPS % Get Adjusted records that were not corrected using Water samples % Only records corrected get error values % ---------------------------------------------------------------- ind = find( isnan(tsg.SSPS_ADJUSTED_ERROR ) == 1); if ~isempty(tsg.SSPS_CAL) tsg.SSPS_ADJUSTED(ind) = tsg.SSPS_CAL(ind); tsg.SSPS_ADJUSTED_QC(ind) = VALUE_CHANGED; else % If the calibration has been canceled the ADJUSTED value is set to % the raw value % ----------------------------------------------------------------- tsg.SSPS_ADJUSTED(ind) = tsg.SSPS(ind); tsg.SSPS_ADJUSTED_QC(ind) = tsg.SSPS_QC(ind); end % SSJT % Get Adjusted records that were not corrected using Water samples % Only records corrected get error values % ---------------------------------------------------------------- ind = find( isnan(tsg.SSJT_ADJUSTED_ERROR ) == 1); if ~isempty(tsg.SSJT_CAL) tsg.SSJT_ADJUSTED(ind) = tsg.SSJT_CAL(ind); tsg.SSJT_ADJUSTED_QC(ind) = VALUE_CHANGED; else % If the calibration has been canceled the ADJUSTED value is equal to % the raw value % ------------------------------------------------------------------- tsg.SSJT_ADJUSTED(ind) = tsg.SSJT(ind); tsg.SSJT_ADJUSTED_QC(ind) = tsg.SSJT_QC(ind); end % Save tsg application data % -------------------------- setappdata( hMainFig, 'tsg_data', tsg ); end