Effacer les filtres
Effacer les filtres

convert vector of doubles to a cell of strings

3 vues (au cours des 30 derniers jours)
Mike Mierlo van
Mike Mierlo van le 23 Avr 2020
Modifié(e) : Adam Danz le 23 Avr 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?

Réponse acceptée

Adam Danz
Adam Danz le 23 Avr 2020
Modifié(e) : Adam Danz le 23 Avr 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);

Plus de réponses (0)

Catégories

En savoir plus sur Data Type Conversion dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by