声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 1588|回复: 8

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

[复制链接]
发表于 2006-5-10 14:46 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

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

使用道具 举报

发表于 2006-5-10 16:02 | 显示全部楼层

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

<P>把你的数据给一下,我在excel里形成不了'3/5'这样的数据</P>
 楼主| 发表于 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>
 楼主| 发表于 2006-5-10 16:15 | 显示全部楼层
<P>导入后其中的变量P 类型为cell  出现了上面说的问题<BR>变量T 类型是double 显示正常</P>[em01]
 楼主| 发表于 2006-5-10 16:15 | 显示全部楼层
还有就是如果把前面的那些分数项 如3/5这样的去掉 或者改成1 0这样的数 也可以显示正常
发表于 2006-5-10 16:55 | 显示全部楼层

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

'3/5' 这种格式没办法,可以对cell array进行操作
 楼主| 发表于 2006-5-10 20:45 | 显示全部楼层
<P>能有办法在导入数据的时候转换成double类型的吗?<BR></P>
 楼主| 发表于 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>    [1x37 char]    [NaN]    [NaN]    [NaN]<BR></P>[em03]
 楼主| 发表于 2006-5-11 10:28 | 显示全部楼层
真的没其他方法了么?<BR>应该是可以设置的吧?[em05]
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-11-12 22:48 , Processed in 0.065186 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表