How can I take valid data points only and plot them?

I've imported a set of data with some invalid data points which I've already seperated. I already have a logical array of the valid data points (it looks something like ' valid=[0 0 1 1 0] ' ). Now I need to recreate the graph with only the valid points. However, when I try to use the logical array as the index of the data, it gives me an error because the matrix sizes don't match.
The original graph and data (with invalid points still present):
My attempt on plotting the graph with only valid points:
I've also tried:
plot(serial_dates(Wo1),W(Wo1))
however, the same message still pops up.

답변 (1개)

Voss
Voss 2023년 1월 9일
Have you tried
plot(serial_dates(valid_ararat),speed_ararat(valid_ararat))
?

댓글 수: 3

It works, but it changes the x values to numbers again (yyyyddMMHHmm). I need it to be in months.
image for clarification:
Look into using datetime arrays, for instance:
dt_dates = datetime(serial_dates,'ConvertFrom','datenum');
plot(dt_dates(valid_ararat),speed_ararat(valid_ararat))

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

제품

릴리스

R2022b

질문:

2023년 1월 9일

댓글:

2023년 1월 9일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by