Borrar filtros
Borrar filtros

Interactive user figure Window

5 visualizaciones (últimos 30 días)
Rasheedat Alaka
Rasheedat Alaka el 3 de Abr. de 2017
Respondida: Sangeetha Jayaprakash el 5 de Abr. de 2017
Hi, how do I present an information in a figure window that tells the user that a sequence of words will appear and also tells the user to press any key? After pressing any key, the program should go to a different figure window.
  1 comentario
Jan
Jan el 3 de Abr. de 2017
The question is far to general to be answered efficiently. Please post, what you have tried so far and ask a specific question describing, what does not work as expected.
While "go to a different figure window" is clear to you, it is not for the readers.

Iniciar sesión para comentar.

Respuestas (1)

Sangeetha Jayaprakash
Sangeetha Jayaprakash el 5 de Abr. de 2017
It looks like you want to focus on a second figure window when user presses a key on the first one. Try using the "WindowKeyPressFcn" callback function as in the code below:
fig1 = figure;
h1 = uicontrol(fig1,'Style', 'text', 'String',...
'Welcome!!Press any key....',... %replace something with the text you want
'Units','normalized','Position', [0.5 0.5 0.1 0.1]);
fig1.WindowKeyPressFcn = @press_func;
function press_func(src,event)
disp('key was pressed');
fig2 = figure;
h2 = uicontrol(fig2,'Style', 'text','String', 'New fig','Units','normalized',...
'Position', [0.5 0.5 0.1 0.1]);
%switching Visible property to ON brings focus to fig2
if fig2.Visible=='on'
fig2.Visible='off';
end
fig2.Visible='on';
end
For information on different callback functions and the uicontrol properties please look into these links:

Categorías

Más información sobre Interactive Control and Callbacks en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by