Effacer les filtres
Effacer les filtres

edit the content present inside one cell

2 vues (au cours des 30 derniers jours)
Alberto Acri
Alberto Acri le 23 Juin 2023
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'

Réponse acceptée

Walter Roberson
Walter Roberson le 23 Juin 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));

Plus de réponses (0)

Catégories

En savoir plus sur Matrices and Arrays dans Help Center et File Exchange

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by