edit the content present inside one cell
5 次查看(过去 30 天)
显示 更早的评论
Hi! I have two cells like this:
I assume they are not the same as entering them in the same cell gives me the following error message:
Error using vertcat
Dimensions of arrays being concatenated are not consistent.
How can I transform cell B like cell A so that the text has ''?
For example, cell B should have:
- 'in B{1,1}: 'from 0738 to 0378'
- in B{1,2}: 'from 0933 to 0934'
0 个评论
采纳的回答
Walter Roberson
2023-6-23
Notice that in the diagram for A, the entry starts and ends with apostrophe. A is a 1 x 2 cell array, the first entry of which is a character vector.
Notice that in the diagram for B, neither entry has apostrophe, and neither entry has double-quote -- not 'from 0738 to 0738' and not "from 0738 to 0738" . When MATLAB presents text without '' or "" around it, then that text is categorical. So B is 1 x 2 cell, in which the entries are categorical.
However... in R2021b (and current releases) if you have a cell array of categorical values, then the variable browser does not show the contents: instead it would display
| 1 x 1 categorical | 1 x 1 categorical |
So... the output your show cannot happen in the release you have marked as using (R2021b)
Anyhow, try
B = cellstr(string(B));
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Cell Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!