Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
29
Task/Text-processing-2/MATLAB/text-processing-2.m
Normal file
29
Task/Text-processing-2/MATLAB/text-processing-2.m
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
function [val,count] = readdat(configfile)
|
||||
% READDAT reads readings.txt file
|
||||
%
|
||||
% The value of boolean parameters can be tested with
|
||||
% exist(parameter,'var')
|
||||
|
||||
if nargin<1,
|
||||
filename = 'readings.txt';
|
||||
end;
|
||||
|
||||
fid = fopen(filename);
|
||||
if fid<0, error('cannot open file %s\n',a); end;
|
||||
[val,count] = fscanf(fid,'%04d-%02d-%02d %f %d %f %d %f %d %f %d %f %d %f %d %f %d %f %d %f %d %f %d %f %d %f %d %f %d %f %d %f %d %f %d %f %d %f %d %f %d %f %d %f %d %f %d %f %d %f %d \n');
|
||||
fclose(fid);
|
||||
|
||||
count = count/51;
|
||||
|
||||
if (count<1) || count~=floor(count),
|
||||
error('file has incorrect format\n')
|
||||
end;
|
||||
|
||||
val = reshape(val,51,count)'; % make matrix with 51 rows and count columns, then transpose it.
|
||||
|
||||
d = datenum(val(:,1:3)); % compute timestamps
|
||||
|
||||
printf('The following records are followed by a duplicate:');
|
||||
dix = find(diff(d)==0) % check for to consequtive timestamps with zero difference
|
||||
|
||||
printf('number of valid records: %i\n ', sum( all( val(:,5:2:end) >= 1, 2) ) );
|
||||
Loading…
Add table
Add a link
Reference in a new issue