Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

loop to work with the column

조회 수: 3 (최근 30일)
Lev Mihailov
Lev Mihailov 2020년 1월 27일
마감: MATLAB Answer Bot 2021년 8월 20일
Hello! There is a loop, I need to know automatically how many values ​​after the point
X=[1 2 3 4 5 6 90 70 60 50 6 5 4 3 2
1 2 3 4 5 6 60 70 60 50 6 5 4 3 2
1 2 3 4 5 6 60 60 70 50 6 5 4 3 2]';
for i=1:length(X(1,:))
[~,loc1]=max(X);
end
% and now I need to find out how many values ​​from maxim to 6
% ans(1) = 4 % 70 60 50 6 % ans(2)=3 % 60 50 6 % ans(3)=2
how do i do this?
  댓글 수: 2
Stephen23
Stephen23 2020년 1월 27일
"how many values ​​after the point"
What exactly is "the point" ?
What is that loop supposed to do?
Lev Mihailov
Lev Mihailov 2020년 1월 27일
편집: Lev Mihailov 2020년 1월 27일
point of my maximum, the values should be from it to 6 (or close to this value 5.9.6.1)
p.s.the loop should get the same answers as mine
X=[1 2 3 4 5 6 90 70 60 50 6 5 4 3 2
1 2 3 4 5 6 60 70 60 50 6 5 4 3 2
1 2 3 4 5 6 60 60 70 50 6 5 4 3 2]';
% ans(1)=4; ans(2)=3; ans(3)=2

답변 (1개)

KSSV
KSSV 2020년 1월 27일
iwant = sum(X>6,1)
  댓글 수: 1
Lev Mihailov
Lev Mihailov 2020년 1월 27일
iwant =
4 4 4
such a variation gives the wrong answer

제품

Community Treasure Hunt

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

Start Hunting!

Translated by