필터 지우기
필터 지우기

Cell Array and Matrix

조회 수: 3 (최근 30일)
RoboKid
RoboKid 2013년 11월 10일
편집: per isakson 2015년 5월 17일
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
  댓글 수: 1
Azzi Abdelmalek
Azzi Abdelmalek 2013년 11월 10일
What about subtraction?

댓글을 달려면 로그인하십시오.

추가 답변 (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