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

12 次查看(过去 30 天)
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 个评论
yasmine
yasmine 2012-3-13
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 2012-3-13
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)" ?

请先登录,再进行评论。

采纳的回答

TAB
TAB 2012-3-13
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 个评论
yasmine
yasmine 2012-3-27
is this done after the keyboard command or do i use the dbstop/dbquit instead of it?
Image Analyst
Image Analyst 2012-3-27
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.

请先登录,再进行评论。

更多回答(1 个)

ali hamadi
ali hamadi 2017-2-16
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 个评论
Adam
Adam 2017-2-16
编辑:Adam 2017-2-16
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 2017-2-23
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

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Desktop 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by