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

1 view (last 30 days)
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 Comments
Adam
Adam on 11 Mar 2015
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 on 12 Mar 2015
Edited: Jason on 12 Mar 2015
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);

Sign in to comment.

Answers (1)

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

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!