How to call a .m-file through a push button?

I have written a .m file which is performing some operations. Now i want to to execute the .m file that i created through the push button control... When i'l press the button my .m-file will be called and it will be executed.... So how do i achieve this?

 Réponse acceptée

Jan
Jan le 24 Juil 2013
Did you create a button in GUIDE already? Then append a callback function there also. It could have a name like this:
function button1_Callback(ObjectH, EventData)
Then all the code you need is the name of your function. Insert it in the callback, save the file and your are ready.

6 commentaires

Febin Benjamin
Febin Benjamin le 24 Juil 2013
Modifié(e) : Febin Benjamin le 24 Juil 2013
Thanks Jan! :) it worked... And nice profile pic by the way.. :) :)
Jan
Jan le 24 Juil 2013
Thanks, Febin. It has a psychological purpose. I had a neater picture before and got too many questions by email, usually about solving homework problems urgently. I've followed the suggestion of other contributors and tried this picture to look more scary. And the flood of mails stopped immediately! How funny.
Febin Benjamin
Febin Benjamin le 25 Juil 2013
Modifié(e) : Febin Benjamin le 25 Juil 2013
Hehe..... nyc story Jan! :) :)
BSantos
BSantos le 26 Juil 2013
Hey Jan,
I have a question, regarding your answer. (funny sentence!)
First let me give an overview of my project: I have two separate GUIs, saved in two different folders, which one of them with their own functions and different purpose. While running GUI_1 (let's call it like that), the user can push a button and start GUI_2.
Now the problem: If, I do not run (F5) GUI_2 first, add it to the path of GUI_1, I get an error. Otherwise it works just fine!
The question: How can I add the path 'automatically', once the user pushes the button to start GUI_2? Maybe it's important to refer, that both GUIs are not compiled yet (just .m files).
Thanks in advance!!!!
Greets, BS.
Jan
Jan le 26 Juil 2013
@BSantos: Appending a question as a comment to an answer of another question cause confusions and does not allow to accept an answer. So please post this as a new question. Then add the a copy of the complete error message also. Thanks.
BSantos
BSantos le 29 Juil 2013
@Jan Simon: Done! :)

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur App Building dans Centre d'aide et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by