| Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) | 
![]()  | 
	
| 		
			
			 | 
		#1 | 
| 
			
			 初级会员 
			
			
			
			注册日期: 2008-03-29 
				
				年龄: 42 
				
					帖子: 1
				 
				
				
				声望力: 0 ![]()  | 
	
	
	
		
		
			
			 
			
			我用的是matlab6.5,下面是我的kruskal程序: 
		
		
		
		
		
		
		
	b=input('please input the matrix of distance,b='); n=input('please input the number of points,n='); m=size(b,2); [B,i]=sortrows(b',3); B=B'; e=0;T=[]; k=0;t=1:n; for i=1:m; if t(B(1,i))~=t(B(2,i)); T(1:2,k)=B(1:2,i);c=c+B(3,i); k=k+1; tmin=min(t(B(1,i)),t(B(2,i))); tmax=max(t(B(1,i)),t(B(2,i))); for j=1:n; if t(j)==tmax; t(j)==tmin; end end end if k==n-1; break; end end T c 结果出现了这样的错误, ??? Subscript indices must either be real positive integers or logicals. 请问高手,这个要怎么改呢……  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 		
			
			 | 
		#2 | 
| 
			
			 初级会员 
			
			
			
			注册日期: 2008-03-29 
				
				年龄: 45 
				
					帖子: 1
				 
				
				
				声望力: 0 ![]()  | 
	
	
	
		
		
			
			 
			
			b或者n应该为整数, 
		
		
		
		
		
		
		
	b=int32(b); n=int32(n); 因为matlab默认的输入数都为double,而在对于数组的标志时,必须为整数.  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
![]()  | 
	
	
| 主题工具 | |
| 显示模式 | |
		
  | 
	
		 | 
			 
			相似的主题
		 | 
	||||
| 主题 | 主题作者 | 版面 | 回复 | 最后发表 | 
| 【求助】关于用matlab处理图象中感兴趣区域的问题 | chen_lei_1 | MATLAB论坛 | 3 | 2008-06-30 17:19 | 
| [求助]GAMMA函数 | LIKAIYU | MATLAB论坛 | 1 | 2008-04-21 23:55 | 
| [求助]matlab画曲面图的自变量取值问题 | 心际依然 | MATLAB论坛 | 5 | 2008-04-20 17:18 |