Inserting a double to a cell

조회 수: 4 (최근 30일)
Cem Eren Aslan
Cem Eren Aslan 2023년 6월 2일
답변: James Tursa 2023년 6월 2일
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.

채택된 답변

James Tursa
James Tursa 2023년 6월 2일
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]}

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with Simulink에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by