声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 1547|回复: 5

[C/C++] 用2006A打开6.5教程书的文件出错了呢

[复制链接]
发表于 2009-2-23 21:06 | 显示全部楼层 |阅读模式

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

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

x
我用2006Amatlab builder打开一个拷贝下来的6.5教程书的文件出错了:

Building COM object...
mcc -M -silentsetup -d 'C:/Documents and Settings/Administrator/My Documents/zx81/src'  -B 'ccom:zx81,zx81class,1.0'    'C:/Documents and Settings/Administrator/My Documents/zx81/src/zx81/zx81.m'   
Error: File "zx81" is a script M-file and cannot be compiled with the current Compiler.

You may be able to correct this by converting this script into a function.
Try adding 'function zx81' as the first line of zx81.m.
回复
分享到:

使用道具 举报

 楼主| 发表于 2009-2-23 21:20 | 显示全部楼层

M文件是这样的

%zx81.m
%                                这是书本上的文件名。
%                                本文件的功用与 exm081_1.m ,完全相同                                                <1>
a=2;b=2;                                                                                                                                 %                <2>       
clf;shg
x=-a:0.2:a;y=-b:0.2:b;
for i=1:length(y)
   for j=1:length(x)
      if x(j)+y(i)>1
         z(i,j)=0.5457*exp(-0.75*y(i)^2-3.75*x(j)^2-1.5*x(j));
      elseif x(j)+y(i)<=-1
         z(i,j)=0.5457*exp(-0.75*y(i)^2-3.75*x(j)^2+1.5*x(j));
      else z(i,j)=0.7575*exp(-y(i)^2-6.*x(j)^2);
      end
   end
end
axis([-a,a,-b,b,min(min(z)),max(max(z))]);
colormap(flipud(winter));surf(x,y,z);
发表于 2009-2-23 21:53 | 显示全部楼层

回复 沙发 gaodiancake 的帖子

2楼的文件没有报错
1.jpg

评分

1

查看全部评分

 楼主| 发表于 2009-2-24 15:11 | 显示全部楼层
运行没有问题,我想把它转成C++的程序,转换时出错了。
发表于 2009-2-24 20:36 | 显示全部楼层

回复 地板 gaodiancake 的帖子

在我的电脑上可以转换,但是不知道怎么用!一个exe文件可以运行出图……
 楼主| 发表于 2009-2-28 00:07 | 显示全部楼层
谢谢,您能简要说一下转换步骤么?
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

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

GMT+8, 2024-5-14 01:27 , Processed in 0.093928 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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