Cell Array and Matrix
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
RoboKid
le 10 Nov 2013
Modifié(e) : per isakson
le 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 commentaire
Azzi Abdelmalek
le 10 Nov 2013
Modifié(e) : Azzi Abdelmalek
le 10 Nov 2013
What is the expected result? There are several possibilities
Réponse acceptée
Azzi Abdelmalek
le 10 Nov 2013
Modifié(e) : Azzi Abdelmalek
le 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
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Multidimensional Arrays dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!