Conversion from char to matrix

52 Ansichten (letzte 30 Tage)
Eric
Eric am 3 Dez. 2016
Beantwortet: Walter Roberson am 3 Dez. 2016
Hi everyone,
I've a char array that looks like this:
numb = [2:4 6:2:12 17 25 26:28 35 37 38:41 46]
Is there a way that I can change it to a matrix so that I can use the numbers in the char array?
Thanks a lot in advance.
Best,
Eric
  1 Kommentar
Stephen23
Stephen23 am 3 Dez. 2016
The array you show is numeric, not char:
>> numb = [2:4 6:2:12 17 25 26:28 35 37 38:41 46];
>> class(numb)
ans = double

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Walter Roberson
Walter Roberson am 3 Dez. 2016
numb = '[2:4 6:2:12 17 25 26:28 35 37 38:41 46]';
nn = str2num(numb);

Kategorien

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

Community Treasure Hunt

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

Start Hunting!

Translated by