Multiple outputs of a single function in a single array
3 ビュー (過去 30 日間)
古いコメントを表示
JAGAN MOHAN KUMMARI
2018 年 9 月 13 日
コメント済み: JAGAN MOHAN KUMMARI
2018 年 9 月 13 日
Hi,
I am trying for the maximum value of each column of an excel file (total 63 columns).
stress=xlsread('output.xlsx','sheet1')
for i=1:1:63
x=max(s(:,i))
end
This gives me an output as
s=
123
s=
345
s=
232
How can I get all the output values in a single array as
s=
123
345
232.
Also, when I terminate the function with ";" at s=max(s(:,i));
and try to get the output in the command window, it is giving me just the last result 232.
How can I get the results in a single column even when I terminate the statement?
Thanks.
0 件のコメント
採用された回答
その他の回答 (1 件)
Walter Roberson
2018 年 9 月 13 日
x(i) =max(s(:,i));
Or you can skip the loop and use the single statement
x = max(s);
max automatically takes the maximum along each column.
5 件のコメント
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!