How do I create a .m file that will automatically read information into a already created Matlab GUI?

2 次查看(过去 30 天)
In my script (sample.m). I want to call another GUI .m script (GUI.m) and input arguements through my scripts into GUI.m. However the GUI just keeps popping up and will not let me automate the process. How can I do this?
For example the first GUI option is to Load an Image. So you click Load and the specify the file. How can I automate this in my sample.m script.

回答(1 个)

Image Analyst
Image Analyst 2016-10-10
编辑:Image Analyst 2016-10-10
It's just a matter of learning how to stuff your data into controls on your GUI. Perhaps this will help: http://blogs.mathworks.com/videos/category/gui-or-guide/
Basically in your OpeningFcn() function, you need to exctract your passed variables from the "varargin" variable. Then assign them to properties of controls on your GUI, like the "Value" or "String" property. For example:
str = varargin{1};
handles.text1.String = str;
dbl = varargin{2};
handles.slider1.Value = dbl;
Description
This GUI will help the novice user get up to speed very quickly on using GUI-based applications. Everything is laid out in a very simple Step 1, Step 2, Step 3, etc. layout. It is a very good starting point for a typical image analysis application. This application uses GUIDE to do the user interface design, and has most of the basic controls such as buttons, listboxes, checkboxes, radio buttons, scrollbars, etc. It allows the user to select a folder of images, select one or more images and display them, to select a series of options, and to individually or batch process one or more images. The user can .....

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by