Borrar filtros
Borrar filtros

Find minimum of first column of matrix among multiple cells and then second and so on..

4 visualizaciones (últimos 30 días)
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

Respuesta aceptada

Guillaume
Guillaume el 13 de Oct. de 2017
Editada: Guillaume el 13 de Oct. de 2017
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

Más respuestas (0)

Categorías

Más información sobre Data Type Conversion en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by