How do I multiply/subtract a cell array and a matrix for Ex. I want to multiply D and L , Cell array
D = {[1 2] , [1 1] ; [1 6 ] , [5 2] };
and matrix
L=[1 0 0 0; 0 1 0 0 ]

1 件のコメント

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 11 月 10 日
編集済み: Azzi Abdelmalek 2013 年 11 月 10 日
What is the expected result? There are several possibilities

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

 採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 11 月 10 日
編集済み: Azzi Abdelmalek 2013 年 11 月 10 日

0 投票

One of the possibilities
D = {[1 2],[1 1] ;[1 6 ],[5 2]}
L=[1 0 0 0; 0 1 0 0 ];
out=cellfun(@(x) x*L,D,'un',0)
%or maybe
cell2mat(D).*L

1 件のコメント

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 11 月 10 日
What about subtraction?

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeResizing and Reshaping Matrices についてさらに検索

質問済み:

2013 年 11 月 10 日

編集済み:

2015 年 5 月 17 日

Community Treasure Hunt

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

Start Hunting!

Translated by