Error using cellstr. Shows error for element that doesn't exist.
16 ビュー (過去 30 日間)
古いコメントを表示
I am getting the following error:
Error using cellstr (line 44) Element 154 is not a string scalar or character array. All elements of cell input must be string scalars or character arrays.
But the array I am trying to conver has size: [153 4]
I am trying to display the data to MATLAB Table (App Designer).
I am saving the data into a cell matrix form then converting to string to display in a table in the app.
TblAllInfo=[app.FMain',ChannelNameFinal',LocationFinal',ChannelFilter'];
app.UITableAll.Data=cellstr(TblAllInfo);
0 件のコメント
回答 (3 件)
Fangjun Jiang
2020 年 8 月 19 日
I can duplicate the error using this simple example. So the problem is TblAllInfo{1,2}. It is the 154th element. It is not a char array.
a =
3×2 cell array
{'a'} {[1]}
{'a'} {[2]}
{'c'} {[3]}
>> cellstr(a)
Error using cellstr (line 44)
Element 4 is not a string scalar or character array. All elements of cell input must be string
scalars or character arrays.
2 件のコメント
Fangjun Jiang
2020 年 8 月 20 日
編集済み: Fangjun Jiang
2020 年 8 月 20 日
The method depends on the data types. Why don't you show some example data?
In my example data, you could use cellstr(string(a))
参考
カテゴリ
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!