How can I convert double value to cell?

조회 수: 59 (최근 30일)
Mira le
Mira le . 2021년 8월 25일
편집: Awais Saeed . 2021년 8월 25일
Hello every one
I want to convert double value in cell in order to compare with each other
for example I have the cell array S={2 3, 1 4 , 1 2 5}
S{1}=2 3
S{2} = 1 4
S{3} = 1 2 5
double values are taking from matrix
the comparison will effect with each cell value from S with each double value from matrinx t
How can I do it
Thank you

채택된 답변

Awais Saeed
Awais Saeed 2021년 8월 25일
편집: Awais Saeed 님. 2021년 8월 25일
There are multiple ways
t = magic(5); % double
% method one. Convert single element
x = t(1,2)
x = num2cell(x)
% method two. Use curly braces
x = {t(1,2)}
% method three. Convert whole matrix into cell

추가 답변 (0개)


Help CenterFile Exchange에서 Numeric Types에 대해 자세히 알아보기




Community Treasure Hunt

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

Start Hunting!

Translated by