Clear Filters
Clear Filters

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

1 view (last 30 days)
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"

Accepted Answer

per isakson
per isakson on 15 Oct 2017
Edited: per isakson on 15 Oct 2017
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

More Answers (0)

Categories

Find more on Multidimensional Arrays in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!