MATLAB Answers

How do I set the getkey figure as invisible?

2 views (last 30 days)
LJM on 21 Dec 2017
I'm using getkey to record responses to stimuli, but it currently pops up in the bottom corner which creates a distraction. I'm new to matlab and I've had a play around with the figure settings but haven't been able to stop it from appearing.
The code for the figure window is:
% Set up the figure
% May be the position property should be individually tweaked to avoid visibility
fh = figure('keypressfcn',callstr, ... 'windowstyle','modal',... 'position',[0 -40 1 1],... 'Name','GETKEY', ... 'userdata','timeout') ;
Any help would be really appreciated! Thanks.
  1 Comment
Jan on 5 Jul 2019
What is the actual problem you want to solve? What does "record repsonses to stimuli" exactly mean?

Sign in to comment.

Answers (1)

Jos (10584)
Jos (10584) on 18 Jan 2018
Dear LJM,
I am the author of this function. Unfortunately you cannot hide the figure completely as it requires to be modal. However, if you have created your own figure and want to use GETKEY, you can incorporate the code of my function into your own figure to receive key presses.
Take care, Jos
  1 Comment
Ricardo Martín Aldazábal
Hi, I'm creating a speed control for a car for my final degree project and I'm using the getkeywait (extremely useful btw) inside a for loop. The trouble I have is that it keeps opening and closing its own figure delaying the simulation. At the end of the loop i use a subplot (2,2,p) to create a figure with different variables (instant speed vs time, gravity acceleration vs time, etc). Is it possible to add the annoying getkeywait figure inside the subplot so that it won't delay the simulation opening and closing its own figure?
Thanks in advance and congrats for your amazing work,

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!