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

2 次查看(过去 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
@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