필터 지우기
필터 지우기

how to get values from mat - file

조회 수: 11 (최근 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 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