Using find function in Matlab to find data at specific time

How can I use the find function in MATLAB in order to create a variable that includes data starting at time, t=0?
I have tried this:
N = find(Data(:)==0);
but I just get N equal to the number of data that are at t=0, not the actual data themselves.

답변 (1개)

Jan
Jan 2021년 3월 27일
index = find(Data >= 0, 1, 'first');
N = Data(index:end)

댓글 수: 2

gps
gps 2021년 6월 7일
편집: gps 2021년 6월 7일
@Jan thank you for the help! i have a follow up question, is there a way of editing this for the case where my data have two columns, say x and t, rather than one and I just want my variable to contain only the data from column, starting from t=0 and onwards?
index = find(Data(:, 2) >= 0, 1, 'first');
N = Data(index:end, :)

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

카테고리

도움말 센터File Exchange에서 MATLAB에 대해 자세히 알아보기

태그

질문:

gps
2021년 3월 27일

댓글:

Jan
2021년 6월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by