Controlling of two subplots by one slider

조회 수: 2 (최근 30일)
Jan Kubicek
Jan Kubicek 2016년 9월 2일
편집: Adam 2016년 9월 2일
I would like to kindly ask you about slider controlling of two subplots. I have the following variables containing 3D structures with five images:
a(:,:,1)=rand(300,300);
a(:,:,2)=ones(300,300);
a(:,:,3)=zeros(300,300);
a(:,:,4)=5*ones(300,300);
a(:,:,5)=zeros(300,300);
b(:,:,1)=zeros(300,300);
b(:,:,2)=ones(300,300);
b(:,:,3)=zeros(300,300);
b(:,:,4)=ones(300,300);
b(:,:,5)=zeros(300,300);
The variable a shall be placed into subplot(121), and variable b in subplot(122). I need to create one figure containing these two subplots, and one slider simultaneously controlling both subplots. I have done implementation for one series of images:
b(:,:,1)=zeros(300,300);
b(:,:,2)=ones(300,300);
b(:,:,3)=zeros(300,300);
b(:,:,4)=ones(300,300);
b(:,:,5)=zeros(300,300);
smin=1;
smax=5;
hsl = uicontrol('Style','slider','Min',smin,'Max',smax,...
'SliderStep',[1 1]./(smax-smin),'Value',1,...
'Position',[20 20 200 20]);
set(hsl,'Callback',@(hObject,eventdata) imshow(b(:,:,round(get(hObject,'Value')))))
I am unable to modify it for two subplots. Please, can anybody show me MATLAB implementation of the mentioned problem? Thank you very much in advance.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by