edit the content present inside one cell
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Alberto Acri
el 23 de Jun. de 2023
Respondida: Walter Roberson
el 23 de Jun. de 2023
Hi! I have two cells like this:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1417769/image.png)
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 comentarios
Respuesta aceptada
Walter Roberson
el 23 de Jun. de 2023
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 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Matrices and Arrays en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!