Too many input arguments error

조회 수: 9 (최근 30일)
Stelios Fanourakis
Stelios Fanourakis 2018년 1월 15일
편집: Jan 2018년 1월 15일
set(get(gca,'children'),'cdata',squeeze(Img(:,:,S,:),ImgSg(:,:,Si,:),ImgCr(:,:,S1,:)))
If I don't put ImgSg(:,:,Si,:),ImgCr(:,:,S1,:) then it's ok. But why are they too many input arguments?

답변 (2개)

Jan
Jan 2018년 1월 15일
편집: Jan 2018년 1월 15일
The error message concerns squeeze:
A = Img(:,:,S,:)
B = ImgSg(:,:,Si,:);
C = ImgCr(:,:,S1,:);
X = squeeze(A, B, C) % <== 3 inputs, but SQUEEZE takes 1 only
Maybe you want:
squeeze([Img(:,:,S,:), ImgSg(:,:,Si,:), ImgCr(:,:,S1,:)])
or
squeeze(Img(:, :, [S, Si, S1], :))
But then the produced array is 4D and CData is a matrix usually.

Rik
Rik 2018년 1월 15일
I would assume this syntax sets the cdata property of all the children to the same image. If you want to do multiple things, use a loop or repeated code. Or even better: get handles to the objects you are interested in, instead of relying on a specific number and order of children, as this is very prone to change (execution order or another Matlab release).
kids=get(gca,'children');
set(kids(1),'cdata',squeeze(Img(:,:,S,:))
set(kids(2),'cdata',ImgSg(:,:,Si,:))
set(kids(3),'cdata',ImgCr(:,:,S1,:))

카테고리

Help CenterFile Exchange에서 Entering Commands에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by