Max Value of Certain Row in Cell Array?

2 Ansichten (letzte 30 Tage)
Ibro Tutic
Ibro Tutic am 3 Dez. 2015
Kommentiert: Ibro Tutic am 3 Dez. 2015
I have a 15x15 array and I would like the max value from the 4th row, how would I go about doing this?
  2 Kommentare
Image Analyst
Image Analyst am 3 Dez. 2015
Is the 15x15 array in each cell? Or is the cell array itself 15 by 15 and something else is inside each cell, like a scalar? Have you read this: http://matlab.wikia.com/wiki/FAQ#What_is_a_cell_array.3F
Have you seen cellfun()?
Ibro Tutic
Ibro Tutic am 3 Dez. 2015
The cell array itself is 15x15 and there is a scalar value in each cell. Sorry for not clearing that up in the question.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Andrei Bobrov
Andrei Bobrov am 3 Dez. 2015
a = cell2mat(yourcellarray);
out = max(a(4,:));
  3 Kommentare
Stephen23
Stephen23 am 3 Dez. 2015
@Ibro Tutic: really there is no reason to store lots of scalar numeric values in a cell array, when a simple numeric array would make your code much simpler. You can see that the very first step of Andrei Bobrov's Answer is to convert the data to a numeric array, and see how easy the solution is using this numeric array.
Ibro Tutic
Ibro Tutic am 3 Dez. 2015
Yep, I already addressed that. I realized that as soon as I posted the problem and did everything in terms of a numeric array. To get the max value I simply used
max(myarray(4,:)).
Thanks!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Matrices and Arrays 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!

Translated by