📄 xmisdat.m
字号:
% xmisdat.m
% Scope: Determine the missing data into a specified column of an input table,
% when the expected increment between two consecutive data is given.
% Usage: xmisdat
% Inputs: - selection of the input data file (with extension), e.g. xmisdat1.dat
% - selection of the column number to be analyzed, e.g. 1
% - selection the increment value between two consecutive data, e.g. 0.1
% Outputs: - the following output data are listed for the selected column of the
% specified data table: first record value, last record value, maximum
% number of records, number of missing records, and specific missing
% values.
% Last update: 06/06/00
% Copyright (C) 1999-00 by LL Consulting. All Rights Reserved.
clear all
disp(' ');
inpfile = input('Enter the name of the input file (with extension) --> ','s');
disp(' ');
column = input('Select the column number to be analyzed, e.g. 3 --> ');
disp(' ');
incval = input('Select the increment value between consecutive data, e.g. 0.1 --> ');
disp(' ');
inptable = load(inpfile);
[nrow,ncol] = size(inptable);
fprintf('*********************************************************************\n\n');
fprintf('For column = %d of the table %s \n\n',column, inpfile);
fprintf('First record value = %f \n', inptable(1,column));
fprintf('Last record value = %f \n', inptable(nrow,column));
max_rec = 1 + round((inptable(nrow,column) - inptable(1,column))/incval);
fprintf('Maximum number of records = %d \n', max_rec );
fprintf('Number of missing records = %d \n', (max_rec - nrow) );
disp(' ');
km = 1;
value = inptable(1,column);
for k = 1:max_rec
if ( abs(value - inptable(km,column)) > 1.e-5 ) % tolerance can be changed
fprintf('Missing record at value = %f \n',value);
else
km = km + 1;
end
value = value + incval;
end
fprintf('\n*********************************************************************\n');
disp(' ');
disp('End of the program XMISDAT.m ');
disp(' ');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -