How to use max function in cell arrays or structures?
显示 更早的评论
I have a cell arrays:
.

.
how do i apply the
max function
to get the maximum 7x2 matrix value across all 3 matrices?
Example
g{1,1} = 1 2 3
2 4 5
5 3 2
g{1,2} = 2 4 1
1 7 2
1 1 2
g{1,3} = 2 2 2
3 1 2
4 8 1
So i will bring the the highest matrix such that
A = 2 4 3
3 7 5
5 8 2
采纳的回答
更多回答(1 个)
Azzi Abdelmalek
2014-11-2
v={rand(7,2),rand(7,2),rand(7,2)}
a=cell2mat(v)
out=max(a(:))
4 个评论
hithere
2014-11-2
Azzi Abdelmalek
2014-11-2
编辑:Azzi Abdelmalek
2014-11-2
No, it was just an example, if v is your cell array just write
a=cell2mat(v)
out=max(a(:))
hithere
2014-11-2
Azzi Abdelmalek
2014-11-2
g{1,1} = [1 2 3
2 4 5
5 3 2]
g{1,2} =[ 2 4 1
1 7 2
1 1 2]
g{1,3} =[ 2 2 2
3 1 2
4 8 1]
out=max(reshape(cell2mat(g),3,3,[]),[],3)
类别
在 帮助中心 和 File Exchange 中查找有关 Matrices and Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!