How do get the cell matrix to be double?

5 views (last 30 days)
Derick Wong
Derick Wong on 4 Jan 2014
Edited: Azzi Abdelmalek on 4 Jan 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]

Answers (2)

Ruwan
Ruwan on 4 Jan 2014
Is this maybe what you are looking for?
DecompDict = cell2mat(dict);
  1 Comment
Derick Wong
Derick Wong on 4 Jan 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 ?

Sign in to comment.


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

Community Treasure Hunt

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

Start Hunting!