Filter löschen
Filter löschen

Inserting a double to a cell

10 Ansichten (letzte 30 Tage)
Cem Eren Aslan
Cem Eren Aslan am 2 Jun. 2023
Beantwortet: James Tursa am 2 Jun. 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.

Akzeptierte Antwort

James Tursa
James Tursa am 2 Jun. 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]}

Weitere Antworten (0)

Kategorien

Mehr zu Shifting and Sorting Matrices finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by