GUI, workspace

9 views (last 30 days)
john on 10 Apr 2012
how can I create any pop up window for save variable for example to "a.mat" , and any pop up window to load variable from the list, from witch I can set .mat file...
please help and thanks for every ideas

Answers (2)

Geoff on 10 Apr 2012
You could use uiputfile to select a file name to be created:
doc uiputfile
(If you want to get a file to load, use uigetfile)
But there is actually a command called uisave which saves variables from the workspace. You just need to tell it what...
doc uisave
To get the variable names from the workspace, use whos:
vars = whos;
Interestingly, you can also do this on an existing .mat file, if you want to choose what to load back later:
vars = whos('-file', 'yourdata.mat');
For list boxes, you need a uicontrol
doc uicontrol
You might want to use GUIDE to help you creating a user interface if you are not comfortable with MatLab or UI programming in other languages.
This is also worth a read:
Geoff on 11 Apr 2012
For your GUI, you need to work through this:
Yes, you can create a popup GUI, but it takes a bit of code. Use GUIDE to help you with the basics, then just link up the events.
To get variables from the base workspace from within a function, use this: evalin('base', 'whos')

Sign in to comment.

Image Analyst
Image Analyst on 12 Apr 2012
You might look at uipickfiles. Either use it as-is, or study it to see how it's done:

Community Treasure Hunt

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

Start Hunting!