필터 지우기
필터 지우기

Why I get 1×0 empty double row vector?

조회 수: 2 (최근 30일)
Aleksandra Pawlak
Aleksandra Pawlak 2020년 12월 27일
댓글: Image Analyst 2020년 12월 28일
Hi, I have problem with my code. I don't know why fidx1 is 1x0 empty double row vector?
min(oh1) and max(oh1) results are:
>>min(oh1)
ans = 102.8890
>> max(oh1)
ans = 106.2470
d1=[0 min(oh1) min(oh1)];
e1=[max(oh1) max(oh1) max([oh1 oh2 oh3 oh4 oh5 oh7 oh11 oh13 oh19 oh23 oh25 oh29 oh35 oh37])];
X1=[xq1];
Y1=[100*r1];
lidx1 = find(X1 == max(oh1));
Ylidx1 = Y1(lidx1);
fidx1 = find(X1 == min(oh1));
Yfidx1 = Y1(fidx1);
  댓글 수: 4
Aleksandra Pawlak
Aleksandra Pawlak 2020년 12월 27일
My code works only for max value.
There's something wrong with part:
fidx1 = find(X1 == min(oh1));
Yfidx1 = Y1(fidx1);
I can't understand this

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

채택된 답변

Ive J
Ive J 2020년 12월 27일
편집: Ive J 2020년 12월 27일
xq1 (and therefore X1) simply may don't contain min(oh1) since you are discretizing [0, max(oh1)]. What you can do is to find the idx corresponding to the closest value to min_oh1
max_oh1 = 104;
xq1 = 0:104/200:104;
[~, fidx1] = min(abs(xq1 - min(oh1)));
  댓글 수: 5
Ive J
Ive J 2020년 12월 27일
The first output argument is the minimum value itself, and the second one is it's index.
Aleksandra Pawlak
Aleksandra Pawlak 2020년 12월 27일
Ok, get it, thanks!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by