Skip to content
Snippets Groups Projects
Commit 54ae5dcb authored by Yves Gouriou's avatar Yves Gouriou
Browse files

Nouvelle fonction pour tester les dates en double (bug dans le logiciel...

Nouvelle fonction pour tester les dates en double (bug dans le logiciel labview d'acquisition). Test simple qui ne teste que des doubles consecutifs.
parent 825844ac
Branches
Tags
No related merge requests found
function testDoubleDate(hMainFig)
%
% Test if there are records with identical date and time.
% Suppress records with the same date (keep only one record)
%
% Test only consecutive date :
% very simple test made because of a bug in the acquisition
% software used on IRD VOS
%
% Input
% -----
% hMainFig ............ Handel to the main user interface
%
% Function called by 'OpenMenuCallback' in tqgqc.m
%
% $Id$
% Get the data from the application GUI
% -------------------------------------
tsg = getappdata( hMainFig, 'tsg_data');
% Find indices of consecutive identical dates
% -------------------------------------------
indIdentRec = find( diff(tsg.DAYD) == 0);
% If there are identical records ...
% ----------------------------------
if ~isempty(indIdentRec)
% Number of indentical dates - Conversion in String
% -------------------------------------------------
nIdentRec = size(indIdentRec, 1);
StrnIdentRec = sprintf( '%d', nIdentRec);
% Create the message text to display the 10 first identical dates
% ---------------------------------------------------------------
nMaxRec = max(10, nIdentRec);
message = { 'ATTENTION: consecutive identical dates are detected'; ' ';...
[StrnIdentRec ' records will be supressed']; ' ';...
'yyyymmddhhmmss'; ' '; tsg.DATE(indIdentRec(1:nMaxRec), :);...
'etc.' };
% Display the message box and blocks execution until the msgbox is deleted.
% -------------------------------------------------------------------------
hMsg1 = msgbox(message,'Test identical date','warn', 'modal');
uiwait(hMsg1);
% returns a cell array of strings containing the structure field names
% associated with the structure tsg.
% --------------------------------------------------------------------
tsgNames = fieldnames(tsg);
% Number of structure field names in 'tsg'
% ----------------------------------------
nMembers = size(tsgNames,1);
% Number of total records/dates
% -----------------------------
nRecords = size(tsg.DAYD,1);
% Loop on the members of the tsg structure
% ----------------------------------------
for i = 1 : nMembers
% Some members of the tsg structure are also structures. We do not
% need to check them
% ----------------------------------------------------------------
if ~isstruct(tsg.(char(tsgNames(i))))
% Size of a member of tsg structure
% ---------------------------------
[n] = size(tsg.(char(tsgNames(i))),1);
% If the member is the same size as tsg.DAYD ..
% --------------------------------------------
if n == nRecords
% Identical records are suppressed only for numeric and character
% arrays
% ---------------------------------------------------------------
if isnumeric(tsg.(char(tsgNames(i))))
tsg.(char(tsgNames(i)))(indIdentRec) = [];
elseif ischar(tsg.(char(tsgNames(i))))
tsg.(char(tsgNames(i)))(indIdentRec, :) = [];
else
% Display the message box and blocks execution until
% the msgbox is deleted.
% --------------------------------------------------
hMsg2 = msgbox('ATTENTION: type of matrix unknown - CHECK testDoubleDate.m',...
'SCRIPT : testDoubleDate.m', 'modal');
uiwait(hMsg2);
end
end
end
end
end
% Save tsg structure
% ------------------
setappdata( hMainFig, 'tsg_data', tsg);
end
......@@ -1323,6 +1323,12 @@ hrbInterpCancel = uicontrol( ...
initParameterChoice( hMainFig, pmhPara );
tsg = getappdata( hMainFig, 'tsg_data');
% Test if there is records with the same date and time.
% very simple test made because of a bug in the acquisition
% software used on IRD VOS
% ---------------------------------------------------------
testDoubleDate(hMainFig);
elseif errTsg > -2
% Problem to read the file or
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment