简体   繁体   中英

Octave: wait for plot to be displayed

I'm an Octave noob but I'm trying to display a graph at the same time as an input in the terminal however the graphics only update after the input therefore I get an unloaded graph:

在此处输入图片说明

This is the code:

 f=figure;
 imshow(img);

 pause(1); % FIX THIS!

 in=input('Input required:', 's');

Pausing for 1 second is sketchy because it doesn't always the graph but without a pause it doesn't even enter the graphics loop. Is there someway to block until the graph is loaded before continuing? I wasn't able to find the required function in the documentation.

You can use drawnow to force the graphics to render and the event queue to be flushed.

f = figure();
imshow(img);

drawnow

in = input('Input required:', 's');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM