필터 지우기
필터 지우기

Use variable in two different functions

조회 수: 6 (최근 30일)
Ali Jaber
Ali Jaber 2016년 4월 3일
댓글: Azzi Abdelmalek 2016년 4월 3일
I have to use variable defined in one function in another function. What should I use? I tried global but it fails with me

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2016년 4월 3일
편집: Azzi Abdelmalek 2016년 4월 3일
[var1,...]=fcn1(...)
get the variable var1 from fcn1 and use it in fcn2
[...]=fcn2(var1,...)
  댓글 수: 5
Azzi Abdelmalek
Azzi Abdelmalek 2016년 4월 3일
You could precise that you are using Guide Matlab. you can share data with guidata function
function btnVisualDataset_Callback(hObject, eventdata, handles)
[filename, pathname] = uigetfile('*.xlsx','Load Dataset');
if filename==0
msgbox('Please Choose Dataset','Error','Error')
return
end
for i=1:10
data = xlsread(filename);
mv{i}=[data(:,i)];
handles.mv=mv;
guidata(hObject,handles)
end
function btnSearch_Callback(hObject, eventdata, handles)
mv=handles.mv
end
Azzi Abdelmalek
Azzi Abdelmalek 2016년 4월 3일
You already get the answer

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by