convert vector of doubles to a cell of strings

3 ビュー (過去 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 Center および File ExchangeData Type Conversion についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by