Yes, your general approach is OK, although there are a few things:
handles
typically refers to a data structure that contains handles to objects. Adding other types of data to this is valid but not advisable because it's simply confusing.the brackets around single outputs of functions are not necessary. Granted, it's a matter of taste and coding style, but it's something I'd recommend against; use brackets only to group things that belong together.
Does your
input
containhandles
somewhere? Similarly, do the functionoutput
s contain a modified version ofhandles
? If no function modifieshandles
, there's of course no need to re-save it every time the callback is called...
So, in summary, do it something like this:
function myFunction_Callback(hObject, eventdata, handles)
...
output = func1(input);
output = func2(output);
output = func3(output);
...
guidata(hObject, output); % <-- NOTE: output contains handles
function output = func1(input)
...
output.handles = input.handles;
...
output.localVar = [1 2 3];
...