How can I use WindowButtonMotionFcn in an app?
14 views (last 30 days)
I am exploring the app designer and attempting to create GUI for a script which I use frequently. The script is not something I wrote, I borrowed it from the FileExchange (PlotDigitizer).
I have managed to create the app layout and add callbacks and code to load the image and calibrate the plot axes. However, the code relies on WindowButtonMotionFcn to track the mouse pointer and for whatever reason, after the image is loaded, anytime the cursor hovers over the plot I get an error that says:
"Undefined function 'Get_Mouse_Location' for input arguments of type 'matlab.ui.Figure'.
Error while evaluating Figure WindowButtonMotionFcn."
I believe the code responsible for this starts at line 110, but I am at a loss as to why, although, I won't be surprised if it's something simple which I overlooked.
% Get mouse location
set(gcf, 'WindowButtonMotionFcn', @Get_Mouse_Location);
m_location = Get_Mouse_Location(app);
There is far too much code to post, so I have attached it instead. If anyone is up for helping me troubleshoot this so I can understand my mistake (and learn from it!), I would appreciate it.
Thanks in advance,
PS - It might help if you tried PlotDigitizer first to understand how the script works, although, if you work from the app... Click Load Image first, locate and load the included plot. The errors will start popping up at that point.