I have expressed my problem with the following image. I would like to implement exactly what I am saying on matlab but I am confused about how to do it.

2 件のコメント

Mathieu NOE
Mathieu NOE 2022 年 12 月 5 日
hi
what have you done so far ?
Christos Tsallis
Christos Tsallis 2022 年 12 月 5 日
編集済み: Christos Tsallis 2022 年 12 月 5 日
I am trying to express it as a code but I am getting confused... I would like to have something like that, [max,min,rightmaxcell,leftmax,cell]=Algorithm(Function). I am trying to create a function which will return these values max,min,rightmaxcell,leftmax,cell. But I can't.

サインインしてコメントする。

 採用された回答

Voss
Voss 2022 年 12 月 5 日

0 投票

data = [321 -0.2; 937 -0.18; 23 -0.16; 472 -0.15; 964 -0.14; 375 -0.13; 902 -0.12; 462 -0.11; 842 0; 735 1; 328 2; 341 2.5; 421 3]
data = 13×2
321.0000 -0.2000 937.0000 -0.1800 23.0000 -0.1600 472.0000 -0.1500 964.0000 -0.1400 375.0000 -0.1300 902.0000 -0.1200 462.0000 -0.1100 842.0000 0 735.0000 1.0000
range_limits = [-0.3 -0.1];
range_limits = sort(range_limits);
in_range_rows = find(data(:,2) >= range_limits(1) & data(:,2) <= range_limits(2));
[max_val,idx] = max(data(in_range_rows,1));
max_row = in_range_rows(idx);
disp(max_row)
5
disp(data(max_row,:))
964.0000 -0.1400

2 件のコメント

Christos Tsallis
Christos Tsallis 2022 年 12 月 5 日
Thank you so much sir
Voss
Voss 2022 年 12 月 5 日
You're welcome!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeResizing and Reshaping Matrices についてさらに検索

タグ

質問済み:

2022 年 12 月 5 日

コメント済み:

2022 年 12 月 5 日

Community Treasure Hunt

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

Start Hunting!

Translated by