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!