Hello everyone. I am working on weather data which i am reading from txt file through matlab code, after that i am comparing log data with that weather data in which i am facing error. I have attached txt file. (Error: Matrix dimensions must agree.)
3 views (last 30 days)
Show older comments
% Calculate mean values from the measurement sequences % Find measurement times where the time interval to the next measurement time is greater than one minute
startIndexMesssequenz = [1 find(diff(timeStampsNoOutLiersRawValuesRANGE0)>duration(0,01:00,0)).'];
2 Comments
Bob Thompson
on 2 Apr 2018
Could you please include more of your code than this? It helps us gather context to understand where your variables come from so we are more likely to find the error.
Answers (2)
Akira Agata
on 4 Apr 2018
How about the following script?
% Read your file and erase single quotes (')
fileName = 'timestamNoOutLierRawValuesRANG0.txt';
fid = fopen(fileName,'r');
C = textscan(fid,'%s','Delimiter','\n');
fclose(fid);
C = erase(C{1},'''');
% Create datetime vector
time = datetime(C,...
'InputFormat', 'dd.MMMM, yyyy HH:mm:ss.SSS',...
'Locale', 'en_US');
% Find start index where the time interval to the next is longer than 1min
startIndexMesssequenz = find(diff(time) > minutes(1));
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!