Finding the max value of a particular row in a cell array and then returning the values of the full row in a table

2 Ansichten (letzte 30 Tage)
I want to return the full values of a row by finding out the max value of a column which falls into that particular row.
Suppose there are two sets of matrix in a cell array like
S{1}=1 2 3
4 5 6
S{2} =3 4 6
7 8 9
I want to find the max value in the first row and third column,in this case its 6 but i want to store the value 3 4 6 in a matrix.
Please help

Akzeptierte Antwort

Stephen23
Stephen23 am 13 Nov. 2018
Bearbeitet: Stephen23 am 13 Nov. 2018
>> S = {[1,2,3;4,5,6],[3,4,6;7,8,9]};
>> A = cat(3,S{:});
>> [~,idx] = max(A(1,3,:))
idx = 2
>> V = A(1,:,idx)
V =
3 4 6

Weitere Antworten (0)

Kategorien

Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by