Get maximum value for a row in a MATLAB table

13 visualizzazioni (ultimi 30 giorni)
Robert Demyanovich
Robert Demyanovich il 9 Mar 2022
Risposto: Voss il 9 Mar 2022
I need to get the maximum value for a specific row in a MATLAB table (not matrix). Let the variable i specify the row number in the table,

Risposte (1)

Voss
Voss il 9 Mar 2022
t = table(randn(10,1),randn(10,1))
t = 10×2 table
Var1 Var2 ________ ________ -1.0096 -0.17839 0.11734 0.91067 1.6059 -1.3539 0.77477 -1.7898 0.64388 0.60792 -0.74874 -2.3333 0.70785 -1.286 -1.2768 -0.57887 0.55059 0.24306 -0.45904 1.4979
i = 5;
% maximum value of row i in table t:
max(t{i,:})
ans = 0.6439

Community Treasure Hunt

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

Start Hunting!

Translated by