how to convert logical into charactor
115 次查看(过去 30 天)
显示 更早的评论
what is the matlab code for converting a logical value to character value
0 个评论
回答(2 个)
John D'Errico
2018-3-18
编辑:John D'Errico
2018-3-18
To answer the question you insist on asking multiple times.
L is a logical vector. C a character array.
L = rand(10,1) < .5
L =
10×1 logical array
1
1
0
1
1
0
1
1
1
1
C = reshape(char(L + '0'),5,2)
C =
5×2 char array
'10'
'11'
'01'
'11'
'11'
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Type Conversion 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!