How do get the cell matrix to be double?

3 visualizzazioni (ultimi 30 giorni)
Derick Wong
Derick Wong il 4 Gen 2014
Hi all,
How do I change the DecompDict output to become double, similar to dict shown below. And what does it mean by [1x10 double] ?
DecompDict =
'-47' '[0,0,1,0,1,0,1,0,0,1]'
'-17' '[0,0,1,0,1,0,1,0,0,0]'
'-7' '[0,0,1,0,1,0,1,1,1]'
'-3' '[0,0,1,0,1,0,0]'
'-2' '[0,0,1,1]'
'-1' '[0,1]'
'0' '1'
'1' '[0,0,0]'
'2' '[0,0,1,0,0]'
'3' '[0,0,1,0,1,1]'
'7' '[0,0,1,0,1,0,1,1,0]'
'17' '[0,0,1,0,1,0,1,0,1,1]'
'30' '[0,0,1,0,1,0,1,0,1,0]'
dict =
[-47] [1x10 double]
[-17] [1x10 double]
[ -7] [1x9 double]
[ -3] [1x7 double]
[ -2] [1x4 double]
[ -1] [1x2 double]
[ 0] [ 1]
[ 1] [1x3 double]
[ 2] [1x5 double]
[ 3] [1x6 double]
[ 7] [1x9 double]
[ 17] [1x10 double]
[ 30] [1x10 double]

Risposte (2)

Ruwan
Ruwan il 4 Gen 2014
Is this maybe what you are looking for?
DecompDict = cell2mat(dict);
  1 Commento
Derick Wong
Derick Wong il 4 Gen 2014
Hi, I have the dict that is output into file. And from file .txt, I got the values out to become DecompDic. But it does not give me back in double form. How can I get DecompDict to be double form ?

Accedi per commentare.


Azzi Abdelmalek
Azzi Abdelmalek il 4 Gen 2014
Modificato: Azzi Abdelmalek il 4 Gen 2014
out=cellfun(@str2num,DecompDict,'un',0)
To display your data
celldisp(out)
1x10 double means an array of ten numbers (double class)

Categorie

Scopri di più su Data Types in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by