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

2 ビュー (過去 30 日間)
This error appear to me when I run the script and I can´t find the mistake. The right and left members from the following equation are supossed to be scalars:
Assignment has more non-singleton rhs dimensions than non-singleton subscripts
Error in evol_NL (line 15)
B(j,k,l) =
exp(-1i*dt*(Vpot(x(j),y(k),z(l))+(bet-lam)*((A(j,k,l))^2)-3*lam*(Lapla_nn_s(j,k,l))))*A(j,k,l);
'dt', 'bet' and 'lam' are scalars, 'A' and 'Lapla_nn_s' are 5x5x5 matrix, and 'x', 'y' and 'z' are vectors.
Thanks for your help!

採用された回答

Walter Roberson
Walter Roberson 2013 年 8 月 21 日
At the command line, use the command
dbstop if error
and run your program. When it stops, check that all your scalars are indeed scalars.
After that, break the expression up into partial expressions, determining the size() of each portion, until you have tracked down the portion that does not have the size you expect.
  3 件のコメント
Walter Roberson
Walter Roberson 2013 年 8 月 21 日
Which variable turned out to be the problem?
Roberto
Roberto 2013 年 8 月 22 日
'bet' and 'lam' were the problem. I declared them as global in a function but forgot to declare them in the root script, so they changed from the original size 1 to size 0. Thanks again.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeFile Operations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by