Simultaneously display image on two monitors

5 vues (au cours des 30 derniers jours)
Jessica Yorzinski
Jessica Yorzinski le 24 Fév 2019
Commenté : Guillaume le 8 Mar 2019
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);

Réponses (1)

Stephen23
Stephen23 le 24 Fév 2019
Modifié(e) : Stephen23 le 6 Mar 2019
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 commentaires
Jessica Yorzinski
Jessica Yorzinski le 8 Mar 2019
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 le 8 Mar 2019
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.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Environment and Settings dans Help Center et File Exchange

Tags

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by