I have a file called Height which I have imported into MATLAB and I am looking to see when the first value increases by 5
I would then like to assign 1 next to the point where the first value (of Height) increases by 5, or the 0 where it does not increase.
I also have a file for X and Y.
I would then like to combine the three files and the value for H into a matrix like the table below.
This is the code I have so far, but I only get a value of 1 instead of a value of 1 or 0 at the location where Height increased by 5.
Height = Height(1,:)
if Height > 5;
H = 1;
elseif Height < 5;
H = 0;
end;
If anyone has any ideas that would be greatly appreciated.

 채택된 답변

David Hill
David Hill 2022년 4월 6일

0 개 추천

I assume you have a table, T.
T.Height=T.Height>5;

댓글 수: 1

Daniel Gaggini
Daniel Gaggini 2022년 4월 7일
편집: Daniel Gaggini 2022년 4월 7일
Thank you for your help I have been able to solve this problem now.
I have attached the code below, for anyone looking for a solution to a similiar problem.
Applied_Height = Height - Height(1,:);
Working_Height = abs(Applied_Height);
Changing_Height_Position(Working_Height>=5)=1;
Height = Changing_Height_Position'
New_Array = [x,y,Height]

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

추가 답변 (0개)

카테고리

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

제품

릴리스

R2021b

질문:

2022년 4월 6일

편집:

2022년 4월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by