I want to remove the element that are outside the starttime and endtime. Like for example it could be for the first 20 and last 5 entrys. I tried with the function nonzeros and it works for the time array, because the time array only have elements > 0, but not for the high. But I dont know how to remove it on a other way. Below is the Code that I use.
for j = 1:length(high)
if time(j)>= starttime && time(j)<=endtime
t(j) = time(j);
high(j) = high(j);
else
high(j) = [];
end
end
time = nonzeros(time);

 채택된 답변

David Hill
David Hill 2022년 5월 3일

0 개 추천

time(time<starttime|time>endtime)=[];

댓글 수: 3

Lars Urban
Lars Urban 2022년 5월 3일
Yes this is a easier way to eliminate in time the things that are outside thank you! But i still dont know how to get rid of the elements in high. The problem is every high has a time, so if i delete the first 2 in time i also want to delete that in high. My question was not specific enough sorry for that.
high(time<starttime|time>endtime)=[];
time(time<starttime|time>endtime)=[];
Lars Urban
Lars Urban 2022년 5월 4일
Thank you! It works!

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

추가 답변 (0개)

카테고리

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

질문:

2022년 5월 3일

댓글:

2022년 5월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by