Cell Array and Matrix

1 次查看(过去 30 天)
RoboKid
RoboKid 2013-11-10
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
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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Multidimensional Arrays 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by