Q: How can I define multiple public functions within a single .m file? I'm currently working on a MATLAB GUI program. I'm trying to organize the program such that I have a single .m file that contains the GUI logic (responding to button presses and updating displays) and then another .m file that contains functions for doing the actual number crunching. Essentially, I'm trying to make the program more readable by separating the two components.
However, I'm running into a problem. When I attempt to define a function in a .m file, it states that the function name and file name must match. However, I want this .m file to contain several functions that can be called by the GUI .m file. This would thus force me to have a separate .m file for every function that will be called by the GUI .m file... Thus requiring a mess of .m files.
So my question: Is it possible to have a single .m file contain several functions that are callable by an external .m file? Imagine I have a script called math.m. It would be nice to have that file define functions such as add, subtract, divide, multiply, etc. defined in a single file (as opposed to being defined across several files).
