필터 지우기
필터 지우기

Simultaneously display image on two monitors

조회 수: 4 (최근 30일)
Jessica Yorzinski
Jessica Yorzinski 2019년 2월 24일
댓글: Guillaume 2019년 3월 8일
My laptop is connected to two external monitors. I would like an image to appear on each monitor at exactly the same time. When I use this script, the image appears on the monitor for axHandle1 slightly before axHandle2:
figHandle=figure('WindowState', 'fullscreen','MenuBar', 'none', 'ToolBar', 'none','OuterPosition',[4000 0 2560 1440],'color','w');
axHandle1 = axes('Units','normalized','Position',[0 0 1 1],'color','w');
figHandle=figure('WindowState', 'fullscreen','MenuBar', 'none', 'ToolBar', 'none','OuterPosition',[1440 0 2560 1440],'color','w');
axHandle2 = axes('Units','normalized','Position',[0 0 1 1],'color','w');
imshow(rgb1,'Parent',axHandle1);
imshow(rgb2,'Parent',axHandle2);

답변 (1개)

Stephen23
Stephen23 2019년 2월 24일
편집: Stephen23 2019년 3월 6일
Try:
imh(1) = imshow(...., 'Visible','off');
imh(2) = imshow(...., 'Visible','off');
then later:
set(imh, 'Visible','on')
EDIT: Create the figures (or uipanels) with their Visible property set to 'off':
fgh(1) = figure(...., 'Visible','off');
fgh(2) = figure(...., 'Visible','off');
axh(2) = axes(..., 'Parent',fgh(2));
axh(1) = axes(..., 'Parent',fgh(1));
imh(2) = imshow(..., 'Parent',axh(2));
imh(1) = imshow(..., 'Parent',axh(1));
Then, when you want them to both appear simultaneously:
set(fgh, 'Visible','on')
  댓글 수: 12
Jessica Yorzinski
Jessica Yorzinski 2019년 3월 8일
Thanks for these additional suggestions. I was able to get the code to work (see below). However, this code still has the same issue as my original code. When the last line comes into play--set(hp, 'Visible','on')-- an image appears on one screen and then (with a brief delay) the other. They do not appear simultaneously. Any other thoughts?
ScreenSize=get(0,'MonitorPositions');
SecondScreen=ScreenSize(3,:);
ThirdScreen=ScreenSize(2,:);
figHandle(1)=figure('WindowState', 'fullscreen','MenuBar', 'none', 'ToolBar', 'none','OuterPosition',[4000 0 2560 1440],'color','w');
axHandle1 = axes('Units','normalized','Position',[0 0 1 1],'color','w');
axis off
figHandle(2)=figure('WindowState', 'fullscreen','MenuBar', 'none', 'ToolBar', 'none','OuterPosition',[1440 0 2560 1440],'color','w');
axHandle2 = axes('Units','normalized','Position',[0 0 1 1],'color','w');
axis off
I=imread(FaceStimuli_01);rgb1 = flipdim(I,1);
I2=imread(FaceStimuli_02);rgb2 = flipdim(I2,1);
hp(1)=uipanel(figHandle(1), 'BackgroundColor','white','Position',[0 0 1 1],'Visible','off'); axh(1) = axes('Parent',hp(1));
hp(2)=uipanel(figHandle(2),'BackgroundColor','white','Position',[0 0 1 1],'Visible','off'); axh(2) = axes('Parent',hp(2));
imshow(rgb1,'Parent',axh(1));
imshow(rgb2,'Parent',axh(2));
set(hp, 'Visible','on')
Guillaume
Guillaume 2019년 3월 8일
I have no idea if you can do anything better than what Stephan suggested, but you have to bear in mind that what you want may not be achievable as you only control the first link of a fairly long chain. To get an image displayed, it goes through:
  • matlab
  • the java virtual machine
  • the OS
  • the graphics card
  • the monitor panels
Any of these can introduce a jitter over which you have no control.

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

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

태그

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by