Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

Thread Subject:
gui crash

Subject: gui crash

From: Theodor Zouk

Date: 11 Nov, 2011 15:47:14

Message: 1 of 1


I have a checkbox in a gui with the following code:
function checkbox1_Callback(hObject,eventdata,handles)

x = get (handles.checkbox1,'Value');


if x == 1
elseif x == 0


Now, the function "func 1" looks like this:

function func1 (variable1,toggle,handle)

switch toogle
      case 'enable'
            fig = imagesc(variable1);
            set(fig,'Alphadata', ~isnan(variable1));
      case 'disable'

What the code does is that when I check the checkbox something is plotted in the gui's axes. When the checkbox is unchecked the plotted something is removed.

Toggleing between the checked and unchecked works fine until you speed up your clicking, Then my gui crashes, or in other words the gui gets reinitiated with all the fields (fields selected and edited by the user during gui run time) set to default.
So if I toggle to fast (i.e. doubble clicking) on the checkbox the gui crashes as mentioned above.

I get this error messages:

??? Error using ==> guidata at 89
H must be the handle to a figure or figure descent.

Error in ==> myprogram1>checkbox1_Callback at 804

I can´t figure it out what´s the problem that causes the crash. It works fine until you start speeding up your toggleing. Is there anyone matlab guru out there, that might know the solution to this problem or how to approach it?

Best regards


Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us