필터 지우기
필터 지우기

How do get the cell matrix to be double?

조회 수: 3 (최근 30일)
Derick Wong
Derick Wong 2014년 1월 4일
편집: Azzi Abdelmalek 2014년 1월 4일
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]

답변 (2개)

Ruwan
Ruwan 2014년 1월 4일
Is this maybe what you are looking for?
DecompDict = cell2mat(dict);
  댓글 수: 1
Derick Wong
Derick Wong 2014년 1월 4일
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 ?

댓글을 달려면 로그인하십시오.


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

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by