Error while pressing button during loop cycle that changes directory

2 views (last 30 days)
Hello there!
I have a GUIDE interface that calls a script and allows the user to introduce the folder and other parameters. Initially I did this by making the interface to write a .mat file with the variables and then make the script to read that file, and everything worked fine. But now, I have decided to avoid writing files and use guidata to share the variables from interface to script. And it works, more or less. The key feature is that the script is a nested loop that does a lot of cds, and the interface has a button to stop the execution. If I press the stop button while the script is running, I get the following error
Undefined function 'tracking_interface_stop_push_Callback' for input arguments of type 'matlab.ui.control.UIControl'.
I have learned that If, in debug mode, I cd the location of the program files before pushing the button, the error is not thrown. I already added an "addpath" to the folder in which the programs are, in the interface mfile and in the script.
Why does this happen?
Thank you very much for your time
  1 Comment
Jan
Jan on 30 Mar 2016
Edited: Jan on 30 Mar 2016
Please post the relevant part of the code.
It seems like your try to add the folder to the path failed. Where is the function "tracking_interface_stop_push_Callback" stored? In an individual M-function or inside the GUI-M-File? Is it defined as a function handle or as string?
Prefer the usage of absolute paths instead of changing the current directory.

Sign in to comment.

Answers (0)

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!