Too many input arguments error

9 Ansichten (letzte 30 Tage)
Stelios Fanourakis
Stelios Fanourakis am 15 Jan. 2018
Bearbeitet: Jan am 15 Jan. 2018
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?

Antworten (2)

Jan
Jan am 15 Jan. 2018
Bearbeitet: Jan am 15 Jan. 2018
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 am 15 Jan. 2018
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,:))

Kategorien

Mehr zu Entering Commands 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!

Translated by