Filter löschen
Filter löschen

convert vector of doubles to a cell of strings

3 Ansichten (letzte 30 Tage)
Mike Mierlo van
Mike Mierlo van am 23 Apr. 2020
Bearbeitet: Adam Danz am 23 Apr. 2020
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?

Akzeptierte Antwort

Adam Danz
Adam Danz am 23 Apr. 2020
Bearbeitet: Adam Danz am 23 Apr. 2020
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);

Weitere Antworten (0)

Kategorien

Mehr zu Data Type Conversion 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