Inserting a double to a cell

4 visualizaciones (últimos 30 días)
Cem Eren Aslan
Cem Eren Aslan el 2 de Jun. de 2023
Respondida: James Tursa el 2 de Jun. de 2023
Hi all,
I try to find minimum value in two different colums and then i want to assign the smallest one to a cell. How can i search this minimum value in two different column? How can i insert a double to cell?
Thx.

Respuesta aceptada

James Tursa
James Tursa el 2 de Jun. de 2023
E.g.,
x = randi(100,10,10) % sample data
x = 10×10
73 86 10 23 73 93 4 48 1 1 98 98 17 23 23 39 87 51 36 84 80 15 48 46 60 68 7 43 10 32 42 39 64 90 75 27 32 27 3 92 98 67 75 8 55 85 88 34 45 61 6 37 32 55 94 86 100 60 17 6 71 95 89 78 88 96 42 19 3 76 28 93 32 92 19 9 2 23 62 91 87 48 17 72 41 42 29 65 47 36 49 33 36 61 13 56 67 23 21 10
columns = [4,7]; % columns to check
minx = min(x(:,columns)) % minimum of the two columns
minx = 1×2
8 2
c{1} = min(minx) % assign smallest one to cell element
c = 1×1 cell array
{[2]}

Más respuestas (0)

Categorías

Más información sobre Shifting and Sorting Matrices en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by