フィルターのクリア

Gui loading a .mat file

11 ビュー (過去 30 日間)
Melvin
Melvin 2012 年 2 月 25 日
回答済み: ali hamadi 2017 年 2 月 16 日
Hi everyone. My question is that, what should i put under a callback function of a pop up menu for example, when I want to load a .mat file. So that .mat file will be loaded to the workspace. Also if i will click to another case of that menu, what code should I use to clear up that workspace in matlab? Thank you very much...
  1 件のコメント
Melvin
Melvin 2012 年 2 月 25 日
I hope someone will answer my question...Thank you again...

サインインしてコメントする。

回答 (2 件)

Image Analyst
Image Analyst 2012 年 2 月 25 日
Here's a snippet for you:
% Have user browse for a file, from a specified "starting folder."
% For convenience in browsing, set a starting folder from which to browse.
startingFolder = 'C:\Program Files\MATLAB';
if ~exist(startingFolder, 'dir')
% If that folder doesn't exist, just start in the current folder.
startingFolder = pwd;
end
% Get the name of the mat file that the user wants to use.
defaultFileName = fullfile(startingFolder, '*.mat');
[baseFileName, folder] = uigetfile(defaultFileName, 'Select a mat file');
if baseFileName == 0
% User clicked the Cancel button.
return;
end
fullFileName = fullfile(folder, baseFileName)
storedStructure = load(fullFileName);
Each function has its own workspace. Clicking on another menu item will clear the old function's workspace - no need to have any code in there to do that. In fact, you have to do special things if you want the other function2 to see function1's workspace. See the FAQ: http://matlab.wikia.com/wiki/FAQ#How_can_I_share_data_between_callback_functions_in_my_GUI.3F
  3 件のコメント
Image Analyst
Image Analyst 2012 年 2 月 25 日
You mean like this
x = storedStructure.x;
y = storedStructure.y;
plot(x, y, 'rs-', 'LineWidth', 2);
Melvin
Melvin 2012 年 2 月 25 日
yeah...thank you very much...

サインインしてコメントする。


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

カテゴリ

Help Center および File ExchangeApp Building についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by