How can I use code in a GUI without launching it?

I am still relatively new to matlab in particular when it comes to working with GUI's. I have taken a fair amount of programming in C++, so other than the syntax at some points matlab has been good to me.
Currently, I am trying to automate a series of GUI's that are used to process data. I have done so with one gui that seemed more or less coded manually. I simply had a driver script create the necessary structure, and passed that into the GUI code with varargin. It would use an "if" to test for input. If nothing was passed in it would launch the GUI like normal, otherwise it would only call the "run" portion of the code that operates on the structure.
My main question is, whats the best way to modify a gui that has been made with "guide" to be a blackbox only? I have attempted to make sense of whats going on in gui_mainfcn.m but hardly understand it. But more importantly have made little progress in determining the best way to use a "guide" produced gui as a "blackbox" called by other scripts.
I am hoping there may be a clean way to do this, but please let me know of any realities I am over looking. Many thanks in advanced.

3 Comments

Why would you use the gui code for that? It sounds like you have a function that is natively called by your gui and can also be called by using your gui as a wrapper. Why make it more complex than it needs to be? (also, I dislike GUIDE)
Its kind of out of my hands for why its like that. But I will say we still like to operate the lower gui separate at times. I have thought, I could pull the the code that performs the needed operations, and put that into the higher gui. I think this is what you are suggesting. The goal is to have one simplified gui operate the rest of the more complex gui's with standard settings. So I could pull the code from each lower gui. Maybe that would be best. My main issue with this is that the lower gui's operate on complex structures that are a pain to recreate. However, if one of the lower gui's is changed, I then have to put in more work to change the generic automated gui. I would still need to do so for a script that automates in their original and separate state them well, but maybe not as extensively.
I can open the gui, enter in standard values and command it to run. Its clean and simple. My only worry is if something was tweaked in later updates that may break these allknowing functions and all assumptions on how they work.
So basically what I found so far feels like a quick fix. However, if its reliable and simple, and doesn't break later down the road, I think its a great solution. I probably need to put some work into understanding gui's better

Sign in to comment.

Answers (0)

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Asked:

on 2 Nov 2018

Commented:

on 3 Nov 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!