How to load a mat file (with its workspace) to GUI

17 views (last 30 days)
Hi i am beginner in Matlab. i am trying to develop a GUI whereby i can extract some variables from a mat file. do some calculations in the GUI and then saved the output in the workspace again. i find difficulty in: 1. load a mat file with its workspace on gui 2. save the new variables after calculation back to the workspace again
thanks a lot.
  2 Comments
yasmine
yasmine on 13 Mar 2012
i want to load the mat file with its own workspace to gui worksapce, perform calculation and save the variables back to the mat file.
TAB
TAB on 13 Mar 2012
The workspace of functions which you are using in GUI are different and Base workspace (which you see in matlab window) is different.
In which workspace you want to load the mat file -and- in which workspace you want to save variable ?
What do you mean by - "load a mat file (with its workspace)" ?

Sign in to comment.

Accepted Answer

TAB
TAB on 13 Mar 2012
You can load the .mat file to your GUI function workspace using
load('YourFile.mat')
Once the vaiabled are loaded and calculation is completed, you can save a variable (say xyz) back to mat file using
save('YourFile.mat','xyz','-append')
For detailed info See
>> doc load
>> doc save
  11 Comments
yasmine
yasmine on 27 Mar 2012
is this done after the keyboard command or do i use the dbstop/dbquit instead of it?
Image Analyst
Image Analyst on 27 Mar 2012
You don't need to set breakpoints at all. Just put that load() in your GUI program - the m-file - wherever you want it. It does not need to be loaded from the command line only.
S = load(fullFileName);
a = S.a;
otherVariable = S.otherVariable;
etc.
You could put this in it's own function, or in the OpenFcn, or wherever you want.

Sign in to comment.

More Answers (1)

ali hamadi
ali hamadi on 16 Feb 2017
Hi everyone ,
i am new in MATLAB , and i have done my project in it and now i need to create a GUI for my project.
using the GUI , i should be able to have the following things : in my project i have 2 different channels with their results. ( AWGN , BEC )
in each channel for example : AWGN , i have different SNR from 0.5 till 3.5.
in each value of the SNR , i have different code length values like : ( 8,16,32,64,128,256,512,1024,2048)
for each code length i have stored results .MAT file , in that file i need to extract a variable called indeces(order of numbers) , and then do some calculation ( show the first 10% , 20% , 30% ...100% of that variable indeces in a txt.file.
so the main idea is : select the channel type , select the SNR values , select the CODE LENGTH , choose the percentage , after that show the results in a .txt file so how to link all the above options together with the right results file. your help is appreciated and helpful...
Regards
  2 Comments
Adam
Adam on 16 Feb 2017
Edited: Adam on 16 Feb 2017
Create a question for this, don't just tag it on as an answer onto a 5 year old question that has already been answered.
ali hamadi
ali hamadi on 23 Feb 2017
Dear Adam ,
Really sorry for disturbing you.
could you please help me in answering my questions, sure if you dont mind and have time for that. here is a link to my question : https://de.mathworks.com/matlabcentral/answers/325973-how-do-i-load-mat-files-into-gui-and-make-link-between-all-the-conditions-to-have-the-last-results

Sign in to comment.

Categories

Find more on Software Development Tools in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!