| Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) | 
![]()  | 
	
| 		
			
			 | 
		#1 | 
| 
			
			 初级会员 
			
			
			
			注册日期: 2008-04-21 
				
				年龄: 39 
				
					帖子: 4
				 
				
				
				声望力: 0 ![]()  | 
	
	
	
		
		
			
			 
			
			大侠们帮忙看看,哪里有问题...... 
		
		
		
		
		
		
		
	function boundsedit_Callback(hObject, eventdata, handles) % hObject handle to boundsedit (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of boundsedit as text % str2double(get(hObject,'String')) returns contents of boundsedit as a double global bounds1; bounds1 = str2double(get(hObject,'string')); if isnan(bounds1) errordlg('You must enter a numeric value','Bad Input','modal') end ........ function boundsedit2_Callback(hObject, eventdata, handles) % hObject handle to boundsedit2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of boundsedit2 as text % str2double(get(hObject,'String')) returns contents of boundsedit2 as a double global bounds2; bounds2 = str2double(get(hObject,'string')); if isnan(bounds2) errordlg('You must enter a numeric value','Bad Input','modal') end ............ function OKpushbutton_Callback(hObject, eventdata, handles) % hObject handle to OKpushbutton (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) global bounds; bounds = []; bounds = [bounds1,bounds2]; disp(bounds); ...... 运行结果::??? Undefined function or variable 'bounds1'. Error in ==> GA_user>OKpushbutton_Callback at 328 bounds = [bounds1,bounds2]; Error in ==> gui_mainfcn at 75 feval(varargin{:}); Error in ==> GA_user at 44 gui_mainfcn(gui_State, varargin{:}); ??? Error while evaluating uicontrol Callback. 这是为什么啊?已经申明了global,怎么还是不能访问到bounds1,bounds2 阿??/  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 		
			
			 | 
		#2 | 
| 
			
			 初级会员 
			
			
			
			注册日期: 2008-05-02 
				
				年龄: 39 
				
					帖子: 25
				 
				
				
				声望力: 18 ![]()  | 
	
	
	
		
		
			
			 
			
			我和你的问题差不多,只要你要调用某个全局变量,你就必须用global在之前在短衣一次,即调用变量时,还要定义一下。不知我说明白没?
		 
		
		
		
		
		
		
		
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 		
			
			 | 
		#3 | 
| 
			
			 初级会员 
			
			
			
			注册日期: 2008-04-21 
				
				年龄: 39 
				
					帖子: 4
				 
				
				
				声望力: 0 ![]()  | 
	
	
	
		
		
			
			 
			
			明白了,后来解决了,这样真麻烦......... 
		
		
		
		
		
		
		
	还是谢谢你哈........  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 		
			
			 | 
		#4 | 
| 
			
			 初级会员 
			
			
			
			注册日期: 2008-04-13 
				
				年龄: 39 
				
					帖子: 24
				 
				
				
				声望力: 18 ![]()  | 
	
	
	
		
		
			
			 
			
			hao o:biggrin:
		 
		
		
		
		
		
		
		
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 		
			
			 | 
		#5 | 
| 
			
			 初级会员 
			
			
			
			注册日期: 2009-04-09 
				
				
				
					帖子: 2
				 
				
				
				声望力: 0 ![]()  | 
	
	
	
		
		
			
			 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
![]()  | 
	
	
| 主题工具 | |
| 显示模式 | |
		
  | 
	
		 | 
			 
			相似的主题
		 | 
	||||
| 主题 | 主题作者 | 版面 | 回复 | 最后发表 | 
| 请问这个方程可以用MATLAB解没有? | thb296 | MATLAB论坛 | 6 | 2008-04-28 19:02 | 
| [求助]图像融合方面的知识 | peipei | MATLAB论坛 | 2 | 2008-04-22 21:55 | 
| [求助]GAMMA函数 | LIKAIYU | MATLAB论坛 | 1 | 2008-04-21 23:55 | 
| [求助]关于Matlab与Java混合编程的环境变量设置 | lxduan | MATLAB论坛 | 1 | 2008-04-03 16:23 | 
| 【求助】如何做FFT变换? | ceeshy | MATLAB论坛 | 1 | 2007-12-21 11:27 |