I WANT TO SOLVE THIS PROBLEM
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
abduall hassn
am 22 Aug. 2015
Bearbeitet: abduall hassn
am 3 Nov. 2016
I want select max value from very row
like this until 364
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 22 Aug. 2015
[maxvals, maxidx] = max(YourMatrix, [], 2);
Now maxidx will be a vector of column numbers, one per row.
4 Kommentare
Walter Roberson
am 23 Aug. 2015
The 2 refers to dimension #2, the columns . The above functions equivalently to
for K = 1 : size(YourMatrix,1)
[maxvals(K,1), maxidx(K,1)] = max(YourMatrix(K,:),[]);
end
If you left out the 2, then the default would be to work along the first non-singular dimension, like
for K = 1 : size(YourMatrix,2)
[maxvals(1,K), maxidx(1,K)] = max(YourMatrix(:,K),[]);
end
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!