필터 지우기
필터 지우기

Creating a function in Matlab GUIDE gui other then the auto generated callbacks

조회 수: 1 (최근 30일)
i have an issue.. i am new to matlab hence excuse me if my question is silly i have to generate the eucledian distance of two variables, hence i need to generate another function which calculates the eucledian value in the guide. i tried using the matlab function i.e.
function [d, q, a, b, f] = extendedEuclidean_forward(m1,a1);
but it gave me an error. i have a function shares_callback in which i need to call this eucledian function
function Shares_Callback(hObject, eventdata, handles)
% hObject handle to combineShares (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
M=m1*m2*m3;
a1=M/m1;
a2=M/m2;
a3=M/m3;
[d, q, a, b, f] = extendedEuclidean_forward(m1,a1);
end
please help, developing college project.
  댓글 수: 2
Adam
Adam 2015년 3월 11일
m1, m2, m3 are not defined in the scope of that callback.
The only variables in that scope at the start of the callback are hObject, eventdata and handles.
Most likely you want to have stored m1, m2 and m3 on the handles structure from wherever they came and then access them as
handles.m1, handles.m2, etc
Jason
Jason 2015년 3월 12일
편집: Jason 2015년 3월 12일
Try making handles a variable in your function.
function [d, q, a, b, f] = extendedEuclidean_forward(handles,m1,a1);
And then call the fucntion via:
[d, q, a, b, f] = extendedEuclidean_forward(handles,m1,a1);

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

답변 (1개)

Preshma Linet Pereira
Preshma Linet Pereira 2015년 3월 18일
@adam i have done what you said.. that was an error..thanks ! @jason will implement and let you know

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by