HpW - ok, so you have written a function called update_drag_line_values that you pass in to the draggable function (from the FEX). The draggable function then calls your function.
The Not enough input arguments makes sense because you have added several input parameters to update_drag_line_values but draggable doesn't supply these additional parameters/arguments when calling your function.
The Undefined function or variable 'hObject' makes sense too since the code is trying to access a variable that hasn't been defined.
You can probably do one of two things: pass the GUI figure handle into draggable (you will need to update this code) so that it passes this handle into your function. So your function signature and first couple of lines would become
function new_line_xcoord = update_drag_line_values(line, hFigure)
handles = guidata(hFigure);
And you will need to figure out where in draggable the figure handle gets passed along to your function.
Alternatively, given that you have a handles structure, I'm going to assume that you are using GUIDE to develop your GUI. If you follow https://www.mathworks.com/matlabcentral/answers/146215-pass-data-between-gui-s, what we need to do is set the HandleVisibility property to on, and the Tag property to Gui1 (or whatever tag/name you want for your GUI). Then, in your update_drag_line_values function we would do function new_line_xcoord = update_drag_line_values(line)
hGui = findobj('Tag','Gui1');
if ~isempty(hGui)
handles = guidata(hGui);
end
The second approach is simpler and you don't have to worry about updating the draggable function.
Best Answer