How would I write this code?
Show older comments
I have data like this:
Fourth column is time in UTC/Zulu and the fifth column is stage observations.
1 1 2015 0 3.48
1 1 2015 6 3.48
1 1 2015 12 3.46
1 1 2015 18 3.43
1 2 2015 0 3.39
1 2 2015 6 3.33
1 2 2015 12 3.27
1 2 2015 18 3.21
I am trying to use the find function to index the data correctly.
This is what I have so far but I keep getting errors.
ind = find((obs(:,1)== month) & (obs(:,2) == day) & (obs(:,3) == year) & (obs(:,4) == time));
These are the errors that continue to pop up.
>> COMO2_2015
Error using month (line 44)
Please enter D.
Error in COMO2_2015 (line 5)
ind = find((obs(:,1)== month) & (obs(:,2) == day) & (obs(:,3) == year) &
(obs(:,4) == time));
Answers (1)
What is month?
You are using it as a variable. However, if you have not defined it as a variable, then MATLAB is trying to call the month function. However, doing so without inputs will result in this error.
t = datetime('now')
month(t)
% the error you are seeing due to calling the function without inputs
month
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!