finding a maximum value in a column of a 2 dimensional matrix
20 ビュー (過去 30 日間)
古いコメントを表示
I am new to MATLAB and I need to print a maximum value for the second column of my 2-D matrix.
maximum = max(max(variable));
Is this all I need to find that value for the variable or am I missing something more than likely
0 件のコメント
回答 (1 件)
Dyuman Joshi
2023 年 12 月 4 日
No, that finds the maximum of all values of the 2D matrix.
Use indexing to provide the 2nd column of the matrix to max() -
y = magic(3)
m = max(y(:,2))
6 件のコメント
Voss
2023 年 12 月 4 日
format long g
thrust = [0.1 500; 0.5 1000; 0.9 800] % col1: time; col2: thrust
% [max_time, max_thrust] = max(thrust)
[max_time, max_thrust] = max(thrust,[],1)
max_time = thrust(max_thrust(2),1)
max_thrust = thrust(max_thrust(2),2)
参考
カテゴリ
Help Center および File Exchange で Resizing and Reshaping Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!