convert vector of doubles to a cell of strings

조회 수: 4 (최근 30일)
Mike Mierlo van
Mike Mierlo van 2020년 4월 23일
편집: Adam Danz 2020년 4월 23일
Hi,
I have the vector A=[0;1;0;1];
I want to convert this into the cell array A
4 x 1 cell array
{'no'}
{'yes'}
{'no'}
{'yes'}
How is this done?

채택된 답변

Adam Danz
Adam Danz 2020년 4월 23일
편집: Adam Danz 2020년 4월 23일
A=[0;1;0;1]
options = {'no';'yes'};
s = options(A+1)
or perhaps you'd benefit from working with logical arrays,
TF = logical(A);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Cell Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by