Printing cell array values as simple numbers?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Tuukka Partanen
am 14 Jan. 2021
Bearbeitet: Adam Danz
am 14 Jan. 2021
Hello,
I would like to display the cells of cell array in the following form: 01000001000000010000000000... etc.
How do I print a cell array into such form? Using disp(binaryArray) command only shows the cell arrays contents as in the attached picture. Any help is appreciated!
0 Kommentare
Akzeptierte Antwort
Adam Danz
am 14 Jan. 2021
Bearbeitet: Adam Danz
am 14 Jan. 2021
Options to convert a 1xn cell array containing scalar numbers to a vector (or string)
rng('default') % for reproducibility
x = num2cell(randi(2,1,10)-1) % demo cell with 1 element per cell
% 1)
cell2mat(x)
% 2)
[x{:}]
% 3)
sprintf('%d',[x{:}]) % note: character array
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Cell Arrays 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!