How do I convert live script formulas into a push button in a GUI?
7 views (last 30 days)
Show older comments
I have a mlx file (Figure 1) that displays antenna graphs in live editor when I load a .mat file that has two variables that are doubles (located in the workspace). When i run in live editor (Figure 2), it displays a graph that shows the peak voltage. I am creating a GUI in App designer that has push buttons that will load the .mat file and when I click each button, it will display the same graph that is in Figure 3. I have figured out how to load the data from the source file into one of the push buttons (Figure 4). However, when I want to incorporate the same formula arithmetic in Figure 2, it states "unrecognized function or variable t." therefore, it will not compile (Figure 5).
tl.dr: Instead of a long live script, I want to make a GUI that will allow me to click a push button and display my calculations on my graph.
I appreciate all help please. Thank you
Figure 1
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1051880/image.png)
Figure 2
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1051885/image.png)
Figure 3
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1051890/image.png)
Figure 4
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1051895/image.png)
Figure 5
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1051900/image.png)
0 Comments
Answers (1)
NIVEDITA MAJEE
on 1 Jul 2022
Hi Jasmine,
Since you are loading the "Source04.mat" file into B, you will need to access 't' as 'B.t'. Similarly, you will also need to acces 'V' as 'B.V'. I hope this will solve your issue.
3 Comments
NIVEDITA MAJEE
on 4 Jul 2022
Hi Jasmine,
I could not seem to follow which multiplication and which looping part are you exactly talking about? Do you think you could share the code and the errors you are facing?
Image Analyst
on 4 Jul 2022
@Jasmine after reading this:
attach your .mlapp file and .mat file with the paperclip icon so people can actually try it themselves.
See Also
Categories
Find more on Antennas, Microphones, and Sonar Transducers in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!