フィルターのクリア

Inputs must be 2-D, or at least one input must be scalar

3 ビュー (過去 30 日間)
hamed
hamed 2016 年 7 月 26 日
コメント済み: hamed 2016 年 7 月 27 日
Hello
I want to write the following codes in MATLAB, but I encounter a problem like as following
[H1,c,ms,path]=mytopo(topo);
[l,r,route]=size(H1);
maxc=max(c);
z1=(maxc/r)*ones(r,1);
y=H1*z1;
Note: H1 is 3d matrix. When I want to run the program, the following error occurs:
Error using
Inputs must be 2-D, or at least one input must be scalar.
To compute elementwise TIMES, use TIMES (.*) instead.
Error in Dtrump
y=H1*z1;
Cheers

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2016 年 7 月 26 日
編集済み: Azzi Abdelmalek 2016 年 7 月 26 日
Maybe you want
bsxfun(@times,H1,z1)
I guess z1 is a vector
  1 件のコメント
hamed
hamed 2016 年 7 月 27 日
Hello and Thanks for your response
I tried your answer like:
y=bsxfun(@times,H1,z1);
Error using bsxfun
Non-singleton dimensions of the two input arrays must match each other.
Error in Dtrump (line 19)
bsxfun(@times,H1,z1)

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by