how to get values from mat - file

3 次查看(过去 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 CenterFile Exchange 中查找有关 Workspace 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