How can I convert table of chars to array of strings?
古いコメントを表示
Hello,
I have table variable (Input_table) like this
''1'' ''8'' ''2'' ''5'' '1' '1' ''Z'' ''F'' ''1'' ''3'' ''C'' ''5'' ''Y'' ''U'' ''4'' ''Q'' ''3''
''4'' ''4'' ''0'' ''9'' '1' '8' ''B'' ''R'' ''1'' ''2'' ''E'' ''8'' ''1'' ''Z'' ''1'' ''N'' ''X''
I want to convert every row into one string so the output to be array of 2 rows
'182511ZF13C5YU4Q3'
'440918BR12E81Z1NX'
I have tried
join(char(table2cell(Input_table))
but I get the error
Error using char
Cell elements must be character arrays.
6 件のコメント
madhan ravi
2019 年 8 月 7 日
Share the code that you use to create a table.
David K.
2019 年 8 月 7 日
Without that, I have a shot in the dark that
answer = cellfun(@char, table2cell(Input_table));
will work for what you want.
omar khater
2019 年 8 月 7 日
omar khater
2019 年 8 月 7 日
Guillaume
2019 年 8 月 7 日
Can you use valid matlab syntax to show how to create an example of your table, or attach your table as a mat file. Right now, it's very unclear how the data is stored in your table.
Perhaps, you should also explain how the table was created in the first place.
omar khater
2019 年 8 月 7 日
編集済み: omar khater
2019 年 8 月 7 日
採用された回答
その他の回答 (2 件)
Azzi Abdelmalek
2019 年 8 月 7 日
0 投票
s={'1' '8' '2' '5' '1' '1' 'Z' 'F' '1' '3' 'C' '5' 'Y' 'U' '4' 'Q' '3'
'4' '4' '0' '9' '1' '8' 'B' 'R' '1' '2' 'E' '8' '1' 'Z' '1' 'N' 'X' }
a=cellstr(reshape([s{:}],size(s)))
Azzi Abdelmalek
2019 年 8 月 7 日
編集済み: Azzi Abdelmalek
2019 年 8 月 7 日
0 投票
s={'1' '8' '2' '5' '1' '1' 'Z' 'F' '1' '3' 'C' '5' 'Y' 'U' '4' 'Q' '3'
'4' '4' '0' '9' '1' '8' 'B' 'R' '1' '2' 'E' '8' '1' 'Z' '1' 'N' 'X' }
a=join(s,2)
You can add a delimiter
a=join(s,'',2)
カテゴリ
ヘルプ センター および File Exchange で Tables についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!