필터 지우기
필터 지우기

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

채택된 답변

Guillaume
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개)

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by