MATLAB How Do You Create a Callback Function for a Currency Converter in MATLAB?

AI Thread Summary
A currency converter project involves creating a GUI with source and target currency menus, an input box for the amount, and a button to trigger the conversion. The callback function, which executes when the button is pressed, is essential for processing the user input and displaying the converted output. For beginners, the GUI design tool in MATLAB can generate a template code block for the button, simplifying the coding process. A tutorial on creating a basic adding machine in MATLAB is recommended for further guidance on building similar applications.
phillyj
Messages
30
Reaction score
0
Hi, I'm working on a currency converter and have some trouble trying to understand how to do the callback function. What I have is 2 menus with source and target currency. I also have an edit box to enter the amount. I have to press a convert button and the output is displayed in another text box.

I'm not sure where to start. Do I have to make multiple functions? I'm still new to gui building and only had one lecture. Is this complicated or am I over-thinking this?

Thanks
 
Physics news on Phys.org
A callback function is a function that's triggered upon an action in a GUI, e.g. a button press. For something like this, your callback would be something triggered on the button press to convert the user input to the output currency.

It's been a while since I used it, but as I recall, when you design your GUI and lay down a button in the GUI Creator, MATLAB should automatically give you a (fairly blank) template code block in the .m file associated with the GUI you're building. The following tutorial takes you through a similar task (creation of a basic adding machine):
http://blinkdagger.com/matlab/matlab-gui-graphical-user-interface-tutorial-for-beginners/

Good luck!
 

Similar threads

Replies
6
Views
2K
Replies
5
Views
3K
Replies
2
Views
16K
Replies
14
Views
2K
Replies
12
Views
3K
Replies
1
Views
2K
Replies
5
Views
1K
Replies
1
Views
7K
Back
Top