sunnywu 发表于 2006-5-10 14:46

问一个execl数据导入matlab的问题

我用excel link 将excel中的数据导入给<BR>matlab的一个变量的时候,因为数据是分数跟整数的混合。但是,导入的数据在内存中显示是<BR>char的形式 即变量的类型不是本来要的double<BR>而是excel的cell型了<BR>有办法可以解决么?<BR><BR>比如说本来是这样的数据<BR>3/519/30100<BR>导入到里面却变成<BR>'3/5' ' 19/30'    [ 0]

happy 发表于 2006-5-10 16:02

回复:(sunnywu)问一个execl数据导入matlab的问题

<P>把你的数据给一下,我在excel里形成不了'3/5'这样的数据</P>

sunnywu 发表于 2006-5-10 16:12

<P>太好了 终于有人说话了 哈<BR>我的数据如下:<BR>
<TABLE 486pt; BORDER-COLLAPSE: collapse" cellSpacing=0 cellPadding=0 width=648 border=0 x:str>
<COLGROUP>
<COL style="WIDTH: 54pt" span=9 width=72>

<TR 14.25pt" height=19>
<TD #ebe9ed; BORDER-TOP: #ebe9ed; BORDER-LEFT: #ebe9ed; WIDTH: 54pt; BORDER-BOTTOM: #ebe9ed; HEIGHT: 14.25pt; BACKGROUND-COLOR: transparent" width=72 height=19>词语</TD>
<TD #ebe9ed; BORDER-TOP: #ebe9ed; BORDER-LEFT: #ebe9ed; WIDTH: 54pt; BORDER-BOTTOM: #ebe9ed; BACKGROUND-COLOR: transparent" width=72></TD>
<TD #ebe9ed; BORDER-TOP: #ebe9ed; BORDER-LEFT: #ebe9ed; WIDTH: 54pt; BORDER-BOTTOM: #ebe9ed; BACKGROUND-COLOR: transparent" width=72>DF</TD>
<TD #ebe9ed; BORDER-TOP: #ebe9ed; BORDER-LEFT: #ebe9ed; WIDTH: 54pt; BORDER-BOTTOM: #ebe9ed; BACKGROUND-COLOR: transparent" width=72>PDF</TD>
<TD #ebe9ed; BORDER-TOP: #ebe9ed; BORDER-LEFT: #ebe9ed; WIDTH: 54pt; BORDER-BOTTOM: #ebe9ed; BACKGROUND-COLOR: transparent" width=72>T1</TD>
<TD #ebe9ed; BORDER-TOP: #ebe9ed; BORDER-LEFT: #ebe9ed; WIDTH: 54pt; BORDER-BOTTOM: #ebe9ed; BACKGROUND-COLOR: transparent" width=72>AB</TD>
<TD #ebe9ed; BORDER-TOP: #ebe9ed; BORDER-LEFT: #ebe9ed; WIDTH: 54pt; BORDER-BOTTOM: #ebe9ed; BACKGROUND-COLOR: transparent" width=72>HS</TD>
<TD #ebe9ed; BORDER-TOP: #ebe9ed; BORDER-LEFT: #ebe9ed; WIDTH: 108pt; BORDER-BOTTOM: #ebe9ed; BACKGROUND-COLOR: transparent; mso-ignore: colspan" width=144 colSpan=2>是否关键字</TD></TR>
<TR 14.25pt" height=19>
<TD #ebe9ed; BORDER-TOP: #ebe9ed; BORDER-LEFT: #ebe9ed; BORDER-BOTTOM: #ebe9ed; HEIGHT: 14.25pt; BACKGROUND-COLOR: transparent; mso-ignore: colspan" colSpan=2 height=19>Web应用服务器</TD>
<TD #ebe9ed; BORDER-TOP: #ebe9ed; BORDER-LEFT: #ebe9ed; BORDER-BOTTOM: #ebe9ed; BACKGROUND-COLOR: transparent" align=right x:num>1</TD>
<TD #ebe9ed; BORDER-TOP: #ebe9ed; BORDER-LEFT: #ebe9ed; BORDER-BOTTOM: #ebe9ed; BACKGROUND-COLOR: transparent" align=right x:num>1</TD>
<TD #ebe9ed; BORDER-TOP: #ebe9ed; BORDER-LEFT: #ebe9ed; BORDER-BOTTOM: #ebe9ed; BACKGROUND-COLOR: transparent" align=right x:num>1</TD>
<TD #ebe9ed; BORDER-TOP: #ebe9ed; BORDER-LEFT: #ebe9ed; BORDER-BOTTOM: #ebe9ed; BACKGROUND-COLOR: transparent" align=right x:num>1</TD>
<TD #ebe9ed; BORDER-TOP: #ebe9ed; BORDER-LEFT: #ebe9ed; BORDER-BOTTOM: #ebe9ed; BACKGROUND-COLOR: transparent" align=right x:num>1</TD>
<TD #ebe9ed; BORDER-TOP: #ebe9ed; BORDER-LEFT: #ebe9ed; BORDER-BOTTOM: #ebe9ed; BACKGROUND-COLOR: transparent" align=right x:num>1</TD>
<TD #ebe9ed; BORDER-TOP: #ebe9ed; BORDER-LEFT: #ebe9ed; BORDER-BOTTOM: #ebe9ed; BACKGROUND-COLOR: transparent"></TD></TR>
<TR 14.25pt" height=19>
<TD #ebe9ed; BORDER-TOP: #ebe9ed; BORDER-LEFT: #ebe9ed; BORDER-BOTTOM: #ebe9ed; HEIGHT: 14.25pt; BACKGROUND-COLOR: transparent; mso-ignore: colspan" colSpan=2 height=19>应用服务器</TD>
<TD #ebe9ed; BORDER-TOP: #ebe9ed; BORDER-LEFT: #ebe9ed; BORDER-BOTTOM: #ebe9ed; BACKGROUND-COLOR: transparent">50/76</TD>
<TD #ebe9ed; BORDER-TOP: #ebe9ed; BORDER-LEFT: #ebe9ed; BORDER-BOTTOM: #ebe9ed; BACKGROUND-COLOR: transparent">25/38</TD>
<TD #ebe9ed; BORDER-TOP: #ebe9ed; BORDER-LEFT: #ebe9ed; BORDER-BOTTOM: #ebe9ed; BACKGROUND-COLOR: transparent" align=right x:num>0</TD>
<TD #ebe9ed; BORDER-TOP: #ebe9ed; BORDER-LEFT: #ebe9ed; BORDER-BOTTOM: #ebe9ed; BACKGROUND-COLOR: transparent" align=right x:num>0</TD>
<TD #ebe9ed; BORDER-TOP: #ebe9ed; BORDER-LEFT: #ebe9ed; BORDER-BOTTOM: #ebe9ed; BACKGROUND-COLOR: transparent" align=right x:num>0</TD>
<TD #ebe9ed; BORDER-TOP: #ebe9ed; BORDER-LEFT: #ebe9ed; BORDER-BOTTOM: #ebe9ed; BACKGROUND-COLOR: transparent" align=right x:num>0</TD>
<TD #ebe9ed; BORDER-TOP: #ebe9ed; BORDER-LEFT: #ebe9ed; BORDER-BOTTOM: #ebe9ed; BACKGROUND-COLOR: transparent"></TD></TR>
<TR 14.25pt" height=19>
<TD #ebe9ed; BORDER-TOP: #ebe9ed; BORDER-LEFT: #ebe9ed; BORDER-BOTTOM: #ebe9ed; HEIGHT: 14.25pt; BACKGROUND-COLOR: transparent; mso-ignore: colspan" colSpan=2 height=19>WebService</TD>
<TD #ebe9ed; BORDER-TOP: #ebe9ed; BORDER-LEFT: #ebe9ed; BORDER-BOTTOM: #ebe9ed; BACKGROUND-COLOR: transparent">44/76</TD>
<TD #ebe9ed; BORDER-TOP: #ebe9ed; BORDER-LEFT: #ebe9ed; BORDER-BOTTOM: #ebe9ed; BACKGROUND-COLOR: transparent">8/38</TD>
<TD #ebe9ed; BORDER-TOP: #ebe9ed; BORDER-LEFT: #ebe9ed; BORDER-BOTTOM: #ebe9ed; BACKGROUND-COLOR: transparent" align=right x:num>0</TD>
<TD #ebe9ed; BORDER-TOP: #ebe9ed; BORDER-LEFT: #ebe9ed; BORDER-BOTTOM: #ebe9ed; BACKGROUND-COLOR: transparent" align=right x:num>1</TD>
<TD #ebe9ed; BORDER-TOP: #ebe9ed; BORDER-LEFT: #ebe9ed; BORDER-BOTTOM: #ebe9ed; BACKGROUND-COLOR: transparent" align=right x:num>1</TD>
<TD #ebe9ed; BORDER-TOP: #ebe9ed; BORDER-LEFT: #ebe9ed; BORDER-BOTTOM: #ebe9ed; BACKGROUND-COLOR: transparent" align=right x:num>0</TD>
<TD #ebe9ed; BORDER-TOP: #ebe9ed; BORDER-LEFT: #ebe9ed; BORDER-BOTTOM: #ebe9ed; BACKGROUND-COLOR: transparent"></TD></TR>
<TR 14.25pt" height=19>
<TD #ebe9ed; BORDER-TOP: #ebe9ed; BORDER-LEFT: #ebe9ed; BORDER-BOTTOM: #ebe9ed; HEIGHT: 14.25pt; BACKGROUND-COLOR: transparent" height=19>中间件</TD>
<TD #ebe9ed; BORDER-TOP: #ebe9ed; BORDER-LEFT: #ebe9ed; BORDER-BOTTOM: #ebe9ed; BACKGROUND-COLOR: transparent"></TD>
<TD #ebe9ed; BORDER-TOP: #ebe9ed; BORDER-LEFT: #ebe9ed; BORDER-BOTTOM: #ebe9ed; BACKGROUND-COLOR: transparent">37/76</TD>
<TD #ebe9ed; BORDER-TOP: #ebe9ed; BORDER-LEFT: #ebe9ed; BORDER-BOTTOM: #ebe9ed; BACKGROUND-COLOR: transparent">19/38</TD>
<TD #ebe9ed; BORDER-TOP: #ebe9ed; BORDER-LEFT: #ebe9ed; BORDER-BOTTOM: #ebe9ed; BACKGROUND-COLOR: transparent" align=right x:num>0</TD>
<TD #ebe9ed; BORDER-TOP: #ebe9ed; BORDER-LEFT: #ebe9ed; BORDER-BOTTOM: #ebe9ed; BACKGROUND-COLOR: transparent" align=right x:num>1</TD>
<TD #ebe9ed; BORDER-TOP: #ebe9ed; BORDER-LEFT: #ebe9ed; BORDER-BOTTOM: #ebe9ed; BACKGROUND-COLOR: transparent" align=right x:num>0</TD>
<TD #ebe9ed; BORDER-TOP: #ebe9ed; BORDER-LEFT: #ebe9ed; BORDER-BOTTOM: #ebe9ed; BACKGROUND-COLOR: transparent" align=right x:num>1</TD>
<TD #ebe9ed; BORDER-TOP: #ebe9ed; BORDER-LEFT: #ebe9ed; BORDER-BOTTOM: #ebe9ed; BACKGROUND-COLOR: transparent"></TD></TR>
<TR 14.25pt" height=19>
<TD #ebe9ed; BORDER-TOP: #ebe9ed; BORDER-LEFT: #ebe9ed; BORDER-BOTTOM: #ebe9ed; HEIGHT: 14.25pt; BACKGROUND-COLOR: transparent" height=19>负载平衡</TD>
<TD #ebe9ed; BORDER-TOP: #ebe9ed; BORDER-LEFT: #ebe9ed; BORDER-BOTTOM: #ebe9ed; BACKGROUND-COLOR: transparent"></TD>
<TD #ebe9ed; BORDER-TOP: #ebe9ed; BORDER-LEFT: #ebe9ed; BORDER-BOTTOM: #ebe9ed; BACKGROUND-COLOR: transparent">28/76</TD>
<TD #ebe9ed; BORDER-TOP: #ebe9ed; BORDER-LEFT: #ebe9ed; BORDER-BOTTOM: #ebe9ed; BACKGROUND-COLOR: transparent">8/38</TD>
<TD #ebe9ed; BORDER-TOP: #ebe9ed; BORDER-LEFT: #ebe9ed; BORDER-BOTTOM: #ebe9ed; BACKGROUND-COLOR: transparent" align=right x:num>0</TD>
<TD #ebe9ed; BORDER-TOP: #ebe9ed; BORDER-LEFT: #ebe9ed; BORDER-BOTTOM: #ebe9ed; BACKGROUND-COLOR: transparent" align=right x:num>1</TD>
<TD #ebe9ed; BORDER-TOP: #ebe9ed; BORDER-LEFT: #ebe9ed; BORDER-BOTTOM: #ebe9ed; BACKGROUND-COLOR: transparent" align=right x:num>1</TD>
<TD #ebe9ed; BORDER-TOP: #ebe9ed; BORDER-LEFT: #ebe9ed; BORDER-BOTTOM: #ebe9ed; BACKGROUND-COLOR: transparent" align=right x:num>0</TD>
<TD #ebe9ed; BORDER-TOP: #ebe9ed; BORDER-LEFT: #ebe9ed; BORDER-BOTTOM: #ebe9ed; BACKGROUND-COLOR: transparent"></TD></TR></TABLE><BR>=mlputmatrix("P",B2:F53)<BR>=mlputmatrix("T",G2:G53)<BR><BR></P>

sunnywu 发表于 2006-5-10 16:15

<P>导入后其中的变量P 类型为cell出现了上面说的问题<BR>变量T 类型是double 显示正常</P>

sunnywu 发表于 2006-5-10 16:15

还有就是如果把前面的那些分数项 如3/5这样的去掉 或者改成1 0这样的数 也可以显示正常

happy 发表于 2006-5-10 16:55

回复:(sunnywu)问一个execl数据导入matlab的问题

'3/5' 这种格式没办法,可以对cell array进行操作

sunnywu 发表于 2006-5-10 20:45

<P>能有办法在导入数据的时候转换成double类型的吗?<BR></P>

sunnywu 发表于 2006-5-10 20:56

<P>我导入
<TABLE 270pt; BORDER-COLLAPSE: collapse" cellSpacing=0 cellPadding=0 width=360 border=0 x:str>
<COLGROUP>
<COL style="WIDTH: 54pt" span=5 width=72>

<TR 14.25pt" height=19>
<TD class=xl22 #ebe9ed; BORDER-TOP: #ebe9ed; BORDER-LEFT: #ebe9ed; WIDTH: 270pt; BORDER-BOTTOM: #ebe9ed; HEIGHT: 14.25pt; BACKGROUND-COLOR: transparent; mso-ignore: colspan" width=360 colSpan=5 height=19 x:str="0.0179    0.3182         0    1.0000 ">0.0179    0.3182         0    1.0000 </TD></TR></TABLE><BR>这样的数据都不行<BR>在matlab里会显示成<BR>P = </P>
<P>                <BR></P>

sunnywu 发表于 2006-5-11 10:28

真的没其他方法了么?<BR>应该是可以设置的吧?
页: [1]
查看完整版本: 问一个execl数据导入matlab的问题