Find minimum of first column of matrix among multiple cells and then second and so on..
4 次查看(过去 30 天)
显示 更早的评论
M is a cell array of 1650x1 rows
M{1} is a matrix of 160x1 rows
Looking to find the minimum among each row of every matrix, different cell
Loop 1:
M{1}(1)
M{2}(1)
M{3}(1)
.
.
until
M{1650}(1)
(Find which is the minimum value)
Loop 160
M{1}(160)
M{2}(160)
M{3}(160)
.
.
until
M{1650}(160)
compare M{1}(1) and M{2}(1) and so on to see which is minimum
0 个评论
采纳的回答
Guillaume
2017-10-13
编辑:Guillaume
2017-10-13
Since all the vectors are all the same size, why are they stored in a cell array. Simpler would be to convert that cell array to a matrix, which also makes the task of finding the minimum trivial:
M = [M{:}]; %convert to a matrix by concatenating all the column vectors together
min_val = min(M, [], 2) %get the minimum across the 1650 columns
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Type Conversion 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!