Simultaneously display image on two monitors

3 次查看(过去 30 天)
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
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