How to covert a cell to multiple line string?
13 ビュー (過去 30 日間)
古いコメントを表示
I have a cell with one coloumn and varing number of rows. The cell contains alpha-numeric string. I want to convert this cell into a multiple line string with each cell content as one line of the string.
How can this be acheived ?
1 件のコメント
Jan
2016 年 9 月 26 日
Cells are arrays. Therefore all columns have the same number of rows. I assume, the contents of the cell elements are char vectors with a different number of clumns.
採用された回答
Jan
2016 年 9 月 26 日
If you use CHAR you get a CHAR matrix padded with blanks on the right side. You can get "multi-line" also by inserting line breaks:
CellString = {'some'; 'strings'; 'to'; 'convert'; 'to'; 'a'; 'char'; 'array'}
CharString = sprintf('%s\n', CellString{:});
その他の回答 (1 件)
Guillaume
2016 年 9 月 26 日
Use char:
cellarrayofstring = {'some'; 'strings'; 'to'; 'convert'; 'to'; 'a'; 'char'; 'array'}
chararrayofstring = char(cellarrayofstring)
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Characters and Strings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!