Info

この質問は閉じられています。 編集または回答するには再度開いてください。

What does Subscripted assignment dimension mismatch mean? I keep getting the same error?

2 ビュー (過去 30 日間)
Hiroshi Nakamura
Hiroshi Nakamura 2015 年 2 月 18 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I keep getting the same error for the following code:-
Error in dct1 (line 12) d(j,k) = c*double(b(j,k));
whereby c = dctmtx(8), and is a 8 * 8 doubles matrix.... I tried replacing c*double(b(j,k)) with c.*double(b(j,k)) but it returned the same error..... Whelp ?
M = 1600
N = 3600
for j = 1:8:M
for k = 1:8:N
d(j,k) = c*double(b(j,k)); //c is a 8*8 doubles matrix
end
end

回答 (2 件)

Yoav Livneh
Yoav Livneh 2015 年 2 月 18 日
The error means that the destination is not the same dimension as the source. In this case, you are trying to write an 8x8 matrix (c) into a 1x1 scalar (d(j,k)).

Hiroshi Nakamura
Hiroshi Nakamura 2015 年 2 月 18 日
OMG I just realized that! Thanks! What I really was trying to do was multiply the c matrix (8*8) by smaller 8*8 matrixes in the 1600*3600 matrix.. Any idea how to do that? Thanks again appreciate your help!

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by