| Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) | 
![]()  | 
	
| 		
			
			 | 
		#1 | 
| 
			
			 初级会员 
			
			
			
			注册日期: 2007-07-08 
				
				
				
					帖子: 4
				 
				
				
				声望力: 0 ![]()  | 
	
	
	
		
		
			
			 
			
			想用matlab来读取一个txt文件, 
		
		
		
		
		
		
			有两个问题 [filename1,pathname1]=uigetfile(' *.txt','Pick a file for read'); fid1=fopen(strcat(pathname1,filename1),'rt'); if(fid1==-1); msgbox('input File or Path is not correct',Warning','warn'); break; end a=3; Data=fscanf(fid1,'%f',a); fclose(fid1); 为什么会出现一个 Error: A BREAK statement appeared outside of a loop. Use RETURN instead. 是不是if那句有问题啊 如果不用那句可以实现读取txt文件 但是只能是数据型的变量,我想读出的数据中还有其他类型的内容 如何实现 谢谢了 我的邮箱是[email protected] 如果在这里说不清楚的话 又乐意帮助我的话 请发个邮件过来 谢谢了 
				__________________ 
		
		
		
		
	细节决定成败!  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 		
			
			 | 
		#2 | 
| 
			
			 初级会员 
			
			
			
			注册日期: 2007-08-13 
				
				
				
					帖子: 6
				 
				
				
				声望力: 0 ![]()  | 
	
	
	
		
		
			
			 
			
			用 load 试试
		 
		
		
		
		
		
		
		
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 		
			
			 | 
		#3 | 
| 
			
			 普通会员 
			
			
			
			注册日期: 2007-12-02 
				
				年龄: 44 
				
					帖子: 74
				 
				
				
				声望力: 19 ![]()  | 
	
	
	
		
		
			
			 
			
			在循环里使用fgetl函数
		 
		
		
		
		
		
		
		
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 |