フィルターのクリア

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

3 ビュー (過去 30 日間)
alireza amiri
alireza amiri 2017 年 10 月 16 日
コメント済み: OCDER 2017 年 10 月 16 日
Hi i have a thesis and in my work,i need to write a code in matlab but when i run it,matlab said: "Assignment has more non-singleton rhs dimensions than non-singleton subscripts" please help me for this
i want A(matrix 3*3) and i have all of a11vec,a12vec,a13vec,a21vec,a22vec,a23vec,a31vec,a32vec,a33vec
%A is amatrix(3*3)
A=zeros(l, m, kindex, j, n+1);
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

採用された回答

OCDER
OCDER 2017 年 10 月 16 日
In this statement:
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)];
the left hand side points to just 1 element, but you're trying to assign a vector to it. Matlab doesn't know what to do in this case. For us humans, it's like saying: this ONE number represents MANY numbers of different values. (No idea what that means...)
To fix, make A a cell array accessible by A{x,y,z,d},
EXAMPLE
A = cell(4,4,4,4);
A{x,y,z,d} = [1;2;3;4;5];
or ensure the right hand side matches the number of elements specified on the left hand side
EXAMPLE
A(x,y,z,[1:10]] = ones(1, 10) %Ex: 10 elements left hand = 10 elements on right
  2 件のコメント
alireza amiri
alireza amiri 2017 年 10 月 16 日
thank you so much
OCDER
OCDER 2017 年 10 月 16 日
You're welcome!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMultidimensional Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by