Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Coding GUI's-formatting

Asked by Dean on 27 Apr 2013

I am writing a pretty involved GUI to calculate skier projectiles and landing impacts. At this moment, most of the code I have written is external to the GUI--I'm making sure everything is running properly before I throw the code into the GUI. I have created all my functions in separate script files which reference each other. When it's time to transfer the code into the GUI is it a bad idea to have all these reference script files? Should I try to keep the GUI self contained by nesting all my functions?

0 Comments

Dean

Products

No products are associated with this question.

1 Answer

Answer by per isakson on 27 Apr 2013
Edited by per isakson on 28 Apr 2013

I assume your "script files" define functions.

"I'm making sure everything is running properly before I throw the code into the GUI." Hopefully you have kept the code, which you used for testing. You might need to repeat some tests.

You do not mention GUIDE. I like that. I never use it.

" by nesting all my functions" Are you saying nested functions?

There is a "design pattern" for making gui-applications, which use nested functions. See GUI Examples using Nested Functions. I relied on that pattern for several years. (That was before Matlabs new OOP-support.) However, your "domain-specific" functions should not be included in the "GUI-functions".

IMO it is a really bad idea not to keep the tested functions as they are. Try to have them separated from the GUI (View) and keep exactly as they are. Invoke them from the callback-functions. Try to make the GUI "thin/dumb/humble".

0 Comments

per isakson

Contact us