필터 지우기
필터 지우기

Array size mismatch cellfun

조회 수: 1 (최근 30일)
RoboKid
RoboKid 2013년 11월 11일
댓글: RoboKid 2013년 11월 11일
Help me.
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)
In result:
size(D)=(2,2) ,size(L)=(2,4) , size(out)=(2,2) Why the size(out) is not equal to (2,4),as by matrix multiplication

채택된 답변

Matt J
Matt J 2013년 11월 11일
편집: Matt J 2013년 11월 11일
The output of cellfun must always satisfy size(out)=size(D). Cellfun always operates on D element by element.
  댓글 수: 1
RoboKid
RoboKid 2013년 11월 11일
Thank you Matt ..

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

추가 답변 (1개)

Walter Roberson
Walter Roberson 2013년 11월 11일
out is going to be a cell array. Each of its locations is going to have a 2 x 4 array. The 2 x 2 corresponds to the shape of the cell array D, 2 x 2, not to the size of the contents of D.
  댓글 수: 2
Matt J
Matt J 2013년 11월 11일
I think you mean, each location is going to have a 1x4 array.
RoboKid
RoboKid 2013년 11월 11일
Thank you Walter.

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

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by