how to get values from mat - file

15 vues (au cours des 30 derniers jours)
saloni singhal
saloni singhal le 30 Mai 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

Réponse acceptée

TAB
TAB le 30 Mai 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

Plus de réponses (0)

Catégories

En savoir plus sur Workspace Variables and MAT Files dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by