声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 1241|回复: 4

请教高手!很急!

[复制链接]
发表于 2005-12-29 15:58 | 显示全部楼层 |阅读模式

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

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

x
<P>看到一个教程里的一个原程序,读不懂,帮忙解释一下,而且帮忙修改一下,运行有问题<BR></P>
<P ><FONT color=#0000ff>% Ask the user for a file name.<p></p></FONT></P>
<P ><p> </p></P>
<P >[datafile datapath]=uigetfile( ' .dat ' <FONT face=宋体>,</FONT> ' Choose a data file ' )<FONT face=宋体>;<p></p></FONT></P>
<P ><p> </p></P>
<P ><FONT color=#0000ff>% If the user selected an existing file<FONT face=宋体>,</FONT>read the data.<p></p></FONT></P>
<P ><FONT color=#0000ff>% (The extra quotes avoid problems with spaces in file or path names <p></p></FONT></P>
<P ><FONT color=#0000ff>% on the Macintosh platform.)<p></p></FONT></P>
<P ><FONT color=#0000ff>% Then determine the variable name from the file name<FONT face=宋体>,<p></p></FONT></FONT></P>
<P ><FONT color=#0000ff>% copy the data to a variable<FONT face=宋体>,</FONT>and plot the data.<p></p></FONT></P>
<P >if datafile<p></p></P>
<P >      eval([ ' load( '  '  ' datapath datafile '  '  ' ) ' ] ' )<FONT face=宋体>;<p></p></FONT></P>
<P >      x=eval(strtok(datafile. ' . ' )<FONT face=宋体>;<p></p></FONT></P>
<P >      plot (x<FONT face=宋体>,</FONT>sin(x))<FONT face=宋体>;<p></p></FONT></P>
<P >end<BR>这里的uigetfile所得到的数据datafile datapath怎么用?<BR>还有load可不可以从其他路径(非M文件所在路径)读入数据<BR>那个fopen怎么加入datapath<BR><p></p></P>
<P> 另外我想把它改成读取txt文件里的数据,请高手指点!</P>
回复
分享到:

使用道具 举报

发表于 2005-12-29 20:13 | 显示全部楼层

回复:(ndyz)请教高手!很急!

doc uigetfile<BR>doc load<BR>doc fopen<BR><BR>自己看吧,帮助写很清楚了
 楼主| 发表于 2005-12-29 20:16 | 显示全部楼层
帮助我都看过啊!都没什么用!看清楚我的问题再回答吧!!!!
发表于 2005-12-29 21:13 | 显示全部楼层

回复:(ndyz)请教高手!很急!

<P>第一次听人说matlab的help没用,偶像</P>
发表于 2005-12-29 21:26 | 显示全部楼层

回复:(ndyz)请教高手!很急!

我学matlab从来没看过书都是help中看的<BR><BR>比如你要载入文件abc.txt,该文件在d:\abc<BR>那么datapath就是d:\abc\ <BR>datafile就是abc.txt<BR>命令:load(d:\abc\abc.txt)
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

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

GMT+8, 2024-6-13 04:16 , Processed in 0.105415 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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