フィルターのクリア

Multiply mx1 matrix to mxn matrix

2 ビュー (過去 30 日間)
Ivy Chen
Ivy Chen 2017 年 11 月 22 日
コメント済み: Ivy Chen 2017 年 11 月 22 日
I have two matrices A and B, A is 4000x1 and B is 4000*5662. How do multiply each row in A (only 1 column) to corresponding row in B (for all 5662 columns). I have tried several ways, but not getting the correct answers or receiving error message "Error using * Inner matrix dimensions must agree".

採用された回答

the cyclist
the cyclist 2017 年 11 月 22 日
編集済み: the cyclist 2017 年 11 月 22 日
% Make up some data
A = rand(4000,1);
B = rand(4000,5662);
C = A.*B; % If you have a recent enough version of MATLAB (R2016b or later)
C = bsxfun(@times,A,B); % If you have an older version
  1 件のコメント
Ivy Chen
Ivy Chen 2017 年 11 月 22 日
thanks!

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

その他の回答 (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