How would I write this code?
조회 수: 3 (최근 30일)
이전 댓글 표시
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));
댓글 수: 0
답변 (1개)
Cris LaPierre
2021년 10월 13일
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
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!