Filter löschen
Filter löschen

edit the content present inside one cell

2 Ansichten (letzte 30 Tage)
Alberto Acri
Alberto Acri am 23 Jun. 2023
Beantwortet: Walter Roberson am 23 Jun. 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'

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 23 Jun. 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));

Weitere Antworten (0)

Kategorien

Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange

Produkte


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by