A= zeros(3,10);A(1,:)=[1:10];B=.5+rand(1,10)*.4;A(2,:,:)=B;C=round(1+rand(1,10)*7);A(3,:,:)= C;Ateam_A= zeros(3,5);team_B= zeros(3,5);for d=[1:1:10] if rem(d,2)==1; for e=[1:1:10] if A(2,e)== max(B) p=e; team_A(:,2,:)=A(:,p,:); A(:,p)=[]; end end elseif rem(d,2)==0 for f=[1:1:10] if A(2,f)== max(C); i=f; team_B(:,2,:)=A(:,i,:); A(:,i)=[]; end end endend Index exceeds matrix dimensions.Error in JAS_HW4 (line 14) if A(2,e)== max(B)
MATLAB: I don’t understand why the matrix dimensions are exceeded
dimensionsexceedsmatrix
Related Question
- How to find largest magnitude in matrix
- If I have an array of 4 dimensions say A=complex(rand(2,2,2,2),rand(2,2,2,2)). If I need to calculate the inverse of this matrix, as defined beow , how should I do it
- How to display in one variable the max of each one of two arrays
- Populate matrix columns based on a vector of index vector
Best Answer