Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

Using handles obtained from another GUI

2 vues (au cours des 30 derniers jours)
J.L. M
J.L. M le 22 Oct 2019
Clôturé : MATLAB Answer Bot le 20 Août 2021
Hello,
I would say that coding in general is not my strong point, nor do I enjoy it (yet!)... however, I have been tasked with managing a program that is used to perform some data analysis. If you are kind enough to help, speaking in the most basic terms would be appreciated, similarly, I'll explain the process of the program in a simplistic way to give you context.
The program was made in GUIDE and is neatly divided into folders for each working part of the GUI.
The process starts by typing a command in the command window, which gives you the opportunity to create a new and save destination of the folder you wish to make/store your data analysis in. Once you press confirm, that GUI closes and another opens, to which, you select the project type (as it requires this to read data related to test types from a config file), again, once confirmed, this GUI closes and another opens allowing you to select the data files you wish to process.
After these three actions have been completed, you are taken to the main GUI in which you can select various options such as; what X represents on your plot, the frequencies to be in/excluded, save figure, blah blah blah.
On the whole, the program is a nice tool, however, the first process of setting it up is an absolute ballache and seems extremely unnecessary to me. I'm not sure why the previous designers did it in such a way. At present, I have recreated the main GUI and added push buttons in that allow for the performing of those first three tasks (currently not programmed because I haven't quite worked out how to execute my idea).
One problem that I've encountered is that the handles are not applicable to copy from the old program into my new version, which, thanks to someones description on MATLAB answers, has allowed me to understand why.
Someone has posted a method of bypassing that and required removing all handles, however, it would seem for the code, it's not feasable/possible, maybe because I don't know how to implement it correctly amongst all subfolders and matlab scripts (over 30).
Unfortunately, I've not been provided any support to guide me through or teach me how to do MATLAB/develop MATLAB designs and after a few weeks of practising and breaking, I have no other option than to ask whether someone can give me a bit of guidance on how to tackle this problem?
All of the code has been written and almost all of it works for the previous one, because I'm designing the same, but different GUI, do I have to rewrite everything? Is it possible to just change handles to be applicable in my program in someway?
Sorry, I can't even give a tl;dr because I'm unsure on what I'm asking exactly. Not particularly helpful, no one else to ask.
Thank you.
P.s, this can be for any version of MATLAB, I am running it on both 2014 and 2019 as the other platform I am operating it from has not got the newest version (and is unable to get it at the present moment).

Réponses (1)

Hope Q
Hope Q le 28 Oct 2019
I offer some guidance, but the scope of what you are asking is too large and too vague for an answer.
From your description, you are a MATLAB user, and are new to any kind of coding. You have described the program from the user's perspective, not the developer's. You will need to learn how to read and understand the code to move forward.
For guidance on how the GUIDE program is structured:
You will need to go through all the .fig/.m pairs in the project and determine which members of handles are for the GUI controls (pushbuttons, checkboxes, etc.) based on the 'Tag' property of each. If the previous developer attached any other data to handles (which is common), determine where that data came from, and copy that data , member by member, to the new structure that is only data (UI controls). Then, you can copy the data-only structure for new use.
Many novice users do not know about breakpoints.
Look for places in the .m files where the statement is something like this:
handles.some_variable = some_value
Set a breakpoint on the line after that statement and inspect the handles structure. You will begin to see which ones are for the GUI and which ones are defined for the data processing.
After you have sorted between GUI elements and user-defined data, you can copy only the user-defined members of the handles structure to a new strucutre for usage that does not depend on the old GUIDE program.

Produits


Version

R2014b

Community Treasure Hunt

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

Start Hunting!

Translated by