Creating a control window
11 次查看(过去 30 天)
显示 更早的评论
Currently I have uigetfile called twice used in conjunction with load to load 2 data files. This is compiled into an executable which plots the data.
Would it be possible to have a control window open where these files can be selected and changed, which would cause the data to be replotted? Currently I have to close the exe and re-run it. I would also like there to be buttons (such as yes or no) which when clicked, would modify some variables and re-plot the data.
I imagine this will get much more complicated with GUI programming compared to my more simple program now which just uses matlab functions and runs through it. I guess my main question is what is required to jump to the beginning of the code and make the changes initiated by the control panel?
0 个评论
采纳的回答
Fangjun Jiang
2011-10-17
You are right about the idea of a GUI to implement the interface you want. Developing a GUI application in MATLAB is not that hard, especially with the help of GUIDE. You can find useful tutorial here. http://blogs.mathworks.com/videos/category/gui-or-guide/. The GUI application can also be compiled to an .exe file since you have the MATLAB Compiler Toolbox.
GUI application is not "jump to the beginning of the code and make the changes initiated by the control panel" though. GUI application is kind of event-driven. Once the user clicks a button, or selects a list, the corresponding code is executed to make things happen.
You could still do what you want with your current code. You could add your code inside a while-loop. With some function like questdlg(),listdlg(), etc. you can check the user input. If the user choose certain input, you can control your program to run for again and again. If the user choose to exit, then you can terminate the execution of your program.
0 个评论
更多回答(1 个)
Walter Roberson
2011-10-17
There are only a couple of real changes:
- you do not destroy the file selection and parameter control windows once the files are selected and parameters for the run are decided
- Instead, when the user clicks asking to process with those parameters, you either hide the selection and control windows (by setting their 'visible' property 'off') or set their button 'enable' properties to be 'off'. This will prevent the user from giving conflicting instructions while something is being processed
- when processing the individual run is finished, either set the windows to be visible again or re-enable their action buttons.
There will be no need to "jump" to the beginning of code: the fact that the GUI is present and enabled will allow the user to re-trigger running the analysis routines.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Environment and Settings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!