Inserting a double to a cell

8 views (last 30 days)
Cem Eren Aslan
Cem Eren Aslan on 2 Jun 2023
Answered: James Tursa on 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.

Accepted Answer

James Tursa
James Tursa on 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]}

More Answers (0)

Categories

Find more on Shifting and Sorting Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!