print the element of a matrix
古いコメントを表示
i wrote this code to print the largest element in the first row of a matrix, but it print the index of the largest number?
how cam i print largest element??
matrix=input("Enter the Matrix");
max=0;
[r,c]=size(matrix);
d=c[j];
n=length(matrix);
for i=0:1
for j=0:c
if [j]> max
max=[j];
end
end
end
disp(max);
採用された回答
その他の回答 (1 件)
Stijn Haenen
2020 年 5 月 17 日
a=-Inf;
for i=1:numel(matrix(:,1))
if matrix(i,1)>a;
a=matrix(i,1);
end
end
disp(a)
1 件のコメント
mohammed almakaleh
2020 年 5 月 17 日
編集済み: mohammed almakaleh
2020 年 5 月 17 日
カテゴリ
ヘルプ センター および File Exchange で Matrix Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!