| Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) | 
|  | 
|  2009-12-22, 14:24 | #1 | 
| 初级会员 注册日期: 2009-12-01 年龄: 35 
					帖子: 1
				声望力: 0  |  在别人的matlab上运行正常的代码,在我这里就是没办法运行 
			
			我用的是matlab(R2009b),运行以下代码 k='Y'; while((k== 'y')|(k== 'Y')) F=input('Please input the temperature in degree F:') C=(5/9)*(F-32) k=input('Do you want to continue? If yes input Y/y, If not input N/n','s') end 提示出错,信息是 ??? Error using ==> tf.tf at 121 Invalid syntax for the "tf" command. Type "help tf" for more information. 运行这段代码 function std = Std(x) if length(x)<2; disp('standard deviation is meaningless for a single number') disp('please return this program for a vector') return end av=sum(x)/length(x); stdPw2=sum((x-av).*(x-av))/(length(x)-1); std=sqrt(stdPw2); end 提示信息如下 ??? Input argument "x" is undefined. Error in ==> Std at 2 if length(x)<2; 这两段代码在别人的matlab上运行都是正常的,纠结…… | 
|   |   | 
|  2009-12-24, 15:22 | #2 | 
| 初级会员 注册日期: 2009-04-10 住址: nuaa 年龄: 40 
					帖子: 20
				声望力: 17  |  回复: 在别人的matlab上运行正常的代码,在我这里就是没办法运行 
			
			回答你第二个问题,你没有在基本空间中定义矢量X,即vector X 你可以在命令窗口中输入》x=[1 2 3]; 》std(x); 即可执行。 第一个我这里也可以运行,我用的是matlabR2009a,不知道你的什么原因。 
				__________________ i ilove inter millan 此帖于 2009-12-24 15:26 被 sogeno 编辑。 原因: 无 | 
|   |   |