# To find the maximum value in each column of a cell array.

조회 수: 1(최근 30일)
Shalmiya Paulraj SOC 2022년 7월 7일
댓글: Shalmiya Paulraj SOC 2022년 7월 8일
I am having cell array of 3072*2 cell, each containing matrix values of 5*1295 double. I need to find the maximum value of each 1295 column. How can I do that? Please help me with this. Thanks in advance.

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

### 채택된 답변

KSSV 2022년 7월 7일
Let A be your cell array of size 3072*2 where each cell has a matrix of size 5x1295.
[m,n] = size(A) ;
iwant = cell(m,n) ;
for i = 1:m
for j = 1:n
iwant{i,j}=max(A{i,j}) ;
end
end
##### 댓글 수: 2표시숨기기 이전 댓글 수: 1
Shalmiya Paulraj SOC 2022년 7월 8일
If, I want to store the maximum value ID only (in the same scenario) means i.e. column id or column number (among 5 column), How can I change above function? Kindly help me with this too. Thanks in advance.

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

### 추가 답변(1개)

Pratyush Swain 2022년 7월 7일
hi,
I hope this will help,
C = {[1 2;10 11] [2 3;4 5]; [3 4;9 10] [4 5;2 3];[2 3;2 3] [5 6;3 4]}
C = 3×2 cell array
{2×2 double} {2×2 double} {2×2 double} {2×2 double} {2×2 double} {2×2 double}
[r,c]=size(C);
for i=1:r
for j=1:c
max(C{i,j})
end
end
ans = 1×2
10 11
ans = 1×2
4 5
ans = 1×2
9 10
ans = 1×2
4 5
ans = 1×2
2 3
ans = 1×2
5 6

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

### 범주

Find more on Matrices and Arrays in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by