Find the maximum value of a column in a table
144 ビュー (過去 30 日間)
古いコメントを表示
I have a spreadsheet that is read into a Matlab table. I need to get the maximum value in column 1. I thought the following would work, but it keeps throwing up an error.
MaxExpTime = max(A(:1));
0 件のコメント
回答 (1 件)
Dave B
2021 年 10 月 29 日
編集済み: Dave B
2021 年 10 月 29 日
The problem here is that A(:,1) returns a table not the values in the table. You can retrieve the values with A.(1) or A{:,1} but better practice is to use variable names (e.g. A.Var1) with a table:
A=table(rand(10,1))
max(A.(1))
max(A{:,1})
max(A.Var1)
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Tables についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!