필터 지우기
필터 지우기

Assignment has more non-singleton rhs dimensions than non-singleton subscripts

조회 수: 1 (최근 30일)
Hi i have problem with this error,please help me for this
A=zeros(4,8,9,8,2);
for l=1:4
for m=1:8
K=1:.25:3;
for kindex=1:9
for j=1:8
for n=[0, 1]
A(l, m, kindex, j, n+1)=[a11vec(l, m, kindex, j, n+1),a12vec(l, m, kindex, j, n+1),a13vec(l, m, kindex, j);a21vec(l, m, kindex, j, n+1),a22vec(l, m, kindex, j, n+1),a23vec(l, m, kindex, n+1);a31vec(l, m, kindex, j),a32vec(l, m, kindex, n+1),a33vec(l, m, kindex, j, n+1)];
end
end
end
end
end
end
A is the martrix(3*3) and i have a11,a12,a13,a21,a22,a23,a31,a32,a33 for l,m,k, and n Variables. but when run,matlab said: "Assignment has more non-singleton rhs dimensions than non-singleton subscripts"

채택된 답변

per isakson
per isakson 2017년 10월 15일
편집: per isakson 2017년 10월 15일
The RHS is a scalar
K>> A( l, m, kindex, j, n+1 )
ans =
0
K>>
the LHS is a 3x3 matrix
K>> whos z
Name Size Bytes Class Attributes
z 3x3 72 double
where
a11vec = ones( 4, 8, 9, 8, 2 );
...
for n=[0, 1]
z = [ a11vec(l,m,kindex,j,n+1), a11vec(l,m,kindex,j,n+1), a11vec(l,m,kindex,j)
a11vec(l,m,kindex,j,n+1), a11vec(l,m,kindex,j,n+1), a11vec(l,m,kindex,n+1)
a11vec(l,m,kindex,j) , a11vec(l,m,kindex,n+1) , a11vec(l,m,kindex,j,n+1)
];
%
A( l, m, kindex, j, n+1 ) = z;
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by