How to turn an array of doubles to cell array

18 Ansichten (letzte 30 Tage)
JFz
JFz am 26 Jan. 2017
Kommentiert: JFz am 27 Jan. 2017
How to turn an array of doubles to cell array? I need to use an array of doubles (they are actually integers) and assign this new array into a table variable names, but I keep getting an error: "The VariableNames property must be a cell array, with each element containing one nonempty string."
Thanks,
jennifer
  2 Kommentare
Guillaume
Guillaume am 26 Jan. 2017
And why on earth do you think that changing an array of numbers into a cell array is going to help with the error that clearly says "the ... must be a cell array ... containing ... string"?
Note that the VariableNames of the table is the name of the columns which you can use to access a particular column (e.g. mytable.somevariablename). It's never going to contain number. So your "I need to assign an array of number into a table variable names" does not make any sense.
Please explain what you're trying to do , showing an example of inputs and corresponding desired output.
JFz
JFz am 27 Jan. 2017
Thanks. I solved the problem.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

the cyclist
the cyclist am 26 Jan. 2017
Bearbeitet: the cyclist am 26 Jan. 2017
You can use the num2cell command to do what you ask.
It may still balk, because the cell contents are numeric. In that case, you could use num2str or sprintf to convert the numeric arrays.

Weitere Antworten (0)

Kategorien

Mehr zu Data Type Conversion finden Sie in Help Center und File Exchange

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by