how to get values from mat - file

3 views (last 30 days)
saloni singhal
saloni singhal on 30 May 2012
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

Accepted Answer

TAB
TAB on 30 May 2012
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

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!