[Matlab] Gui help for adding code

  • #1
761
11
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?
 

Attachments

Last edited:

Answers and Replies

  • #2
12,077
5,745
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.
 
  • #3
761
11
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?
 
  • #4
761
11
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.
 
  • #5
12,077
5,745
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?
 
  • #6
761
11
Yes, you are right but what do you mean by GoButton is called?
 
  • #7
12,077
5,745
Sorry, I meant the GoButton callback function shown in your second image.
 

Related Threads on [Matlab] Gui help for adding code

  • Last Post
Replies
1
Views
4K
  • Last Post
Replies
0
Views
2K
  • Last Post
Replies
6
Views
21K
  • Last Post
Replies
5
Views
3K
  • Last Post
Replies
2
Views
3K
  • Last Post
Replies
2
Views
9K
  • Last Post
Replies
3
Views
2K
  • Last Post
Replies
1
Views
2K
  • Last Post
Replies
13
Views
11K
  • Last Post
Replies
4
Views
660
Top