Cell Array and Matrix
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
RoboKid
am 10 Nov. 2013
Bearbeitet: per isakson
am 17 Mai 2015
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 Kommentar
Azzi Abdelmalek
am 10 Nov. 2013
Bearbeitet: Azzi Abdelmalek
am 10 Nov. 2013
What is the expected result? There are several possibilities
Akzeptierte Antwort
Azzi Abdelmalek
am 10 Nov. 2013
Bearbeitet: Azzi Abdelmalek
am 10 Nov. 2013
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 Kommentar
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Resizing and Reshaping Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!