edit the content present inside one cell

2 次查看(过去 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'

采纳的回答

Walter Roberson
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 个)

类别

Help CenterFile Exchange 中查找有关 Matrices and Arrays 的更多信息

产品


版本

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by