Hi @Gavin,
You mentioned, “I'm having SO much trouble! I think maybe when I call a function from within another function or callback it's going into a new thread. I want it to finish the function before moving on. Is the best way to do that to make the function return a (dummy) value?Since there is nothing to return but completion do I need to declare”
Please see my response to your comments below.
In MATLAB, when you call a function from within another function or a callback, it does not automatically create a new thread; however, the execution order can sometimes be confusing, especially with asynchronous callbacks. To ensure that the calling function waits for the called function to complete, you do not need to return a dummy value. You can simply define your function as follows:
function MyFunction(app) % Your code here end
If you do not need to return any value, you can call it without assigning it to a variable:
MyFunction(app);
Now, if you want to suppress warnings about unused return values, you can use the %#ok comment as you suggested:
fin = MyFunction(app); %#ok
However, it is not necessary to declare a return variable if you do not intend to use it. Just make sure that your function completes its execution before moving on to the next line of code in the calling function.
Hope this helps.