how to get values from mat - file

14 ビュー (過去 30 日間)
saloni singhal
saloni singhal 2012 年 5 月 30 日
sir, I want to store certain value in mat- file then load it in another function and use those variable the values which i want to store in mat-file are like this
mat3 =
handles1;
h15=findobj('tag','ed1');
Fs=str2num(get(h15,'string'));
set(h1,'value',Fs);
mat4 =
h3=findobj('tag','sl3');
handles1;
fnl2=get(h3,'value');
Fnl2=num2str(fnl2);
set(e2,'string',Fnl2)
main;
these two mat3 and mat4 i want to store in mat -file and use.Here handle and main is m-file.i tried type all this in command window then save it.But, its not working like that.so, please tell me how i am suppose to do this

採用された回答

TAB
TAB 2012 年 5 月 30 日
This function saves variable in mat file
function function1
x = 100;
y = 200;
% Save variable x
save('MyFile.mat','x','y');
end
This function reads the variables from mat file
function function2
% Load mat file
load('MyFile.mat')
% Read variables of loaded mat file
new_x = x;
new_y = y;
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeWorkspace Variables and MAT Files についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by