Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

[Matlab] Gui help for adding code

Tags:
  1. Jun 4, 2014 #1
    Hi, all there is an example for gui but I can not do. Could somebody help me. I generated a button in gui then I have to add some function on in. Codes are in the picture. Will I add them under callback function? Why can I not determine where I should I add them. To understand it
    what background should I have?
     

    Attached Files:

    Last edited: Jun 4, 2014
  2. jcsd
  3. Jun 4, 2014 #2

    jedishrfu

    Staff: Mentor

    If you're looking for help you need to supply more information than this screenshot. As it stands, I can't tell if you're writing a Java program or a C/C++ program or even some other language.

    With respect to the call back function, often when defining a GUI button you must supply a function that will be called when the button is pressed. Within this function you can do some action like save data to a database or file, start a new thread of execution to do something or to exit a program...

    Whatever action is done, we usually try to do it quickly within a 1/10 second or so, so that the enduser views the program as being responsive.
     
  4. Jun 4, 2014 #3
    There are two screenhots second one is .m file which is specific for only matlab and the second screenshot
    is the codes I need to insert into it. I launched Gui in matlab then generated a button and edited it with
    inspector. Now I am trying to see in the command window "Go, go, go , world" after pushing it. Is it clear enough now?
     
  5. Jun 4, 2014 #4
    I solved the problem. Thank you for help. I have to just add it bottom of the callback function. But while we are already on this topic can you say why we add them bottom of that function
    to write screen "go, go, go, world" after pushing the button.

    Best Regards.
     
  6. Jun 4, 2014 #5

    jedishrfu

    Staff: Mentor

    My guess is that when the Button is pressed GoButton is called and the disp('go go ...') is called which prints the message to the console. Is that what you mean?
     
  7. Jun 4, 2014 #6
    Yes, you are right but what do you mean by GoButton is called?
     
  8. Jun 4, 2014 #7

    jedishrfu

    Staff: Mentor

    Sorry, I meant the GoButton callback function shown in your second image.
     
  9. May 4, 2015 #8
    Last edited: May 4, 2015
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: [Matlab] Gui help for adding code
  1. Matlab gui coding (Replies: 1)

  2. Help on GUI MATLAB (Replies: 0)

Loading...