I have a 15x15 array and I would like the max value from the 4th row, how would I go about doing this?

댓글 수: 2

Image Analyst
Image Analyst 2015년 12월 3일
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 2015년 12월 3일
The cell array itself is 15x15 and there is a scalar value in each cell. Sorry for not clearing that up in the question.

댓글을 달려면 로그인하십시오.

 채택된 답변

Andrei Bobrov
Andrei Bobrov 2015년 12월 3일

0 개 추천

a = cell2mat(yourcellarray);
out = max(a(4,:));

댓글 수: 3

Ibro Tutic
Ibro Tutic 2015년 12월 3일
Thanks.
Stephen23
Stephen23 2015년 12월 3일
@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.
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!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

질문:

2015년 12월 3일

댓글:

2015년 12월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by