How can I create a function which create other functions?
Mostra commenti meno recenti
I'm using the GUIDE to create a program. I want to create a functions which create many callbacks to differents menu items.
Ex.:
menu item 1 --> callback 1
menu item 2 -->callback 2
menu item 3 --> callback 3
This callbacks came from the function which i created first.
4 Commenti
Stephen23
il 12 Gen 2019
Avoid GUIDE:
I would suggest that a much simpler approach is to use one callback function and add one (or more) input arguments that specify which menu item it is (i.e. the item index). Then inside the function you can simply use that index to perform the required operations.
Daniel Fonsêca
il 13 Gen 2019
Walter Roberson
il 13 Gen 2019
get the Value property of the uicontrol style 'listbox' or 'popup' . You can also get the String property, and use the Value property to index into that, in order to obtain a copy of the line that the user chose.
Note: this response is for the case where "menu" is implemented by way of uicontrol. If you need menu implimented as uimenu objects, hooking into the toolbar just like "File" and "Edit" menus, then there are other approaches.
Daniel Fonsêca
il 13 Gen 2019
Risposte (0)
Categorie
Scopri di più su Interactive Control and Callbacks in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!