MATLAB: Storing Outputs of a two output function recursion

multiple output functionrecursion

Is there a method where I can apply a function with two outputs, and iterate the function recursively for these two outputs. In other words, I want this function to be applied on both outputs of this function until satisfying a condition(in a while loop),
UPDATE:I tried the recursion provided here by Image analyst ,https://www.mathworks.com/matlabcentral/answers/47182-problem-in-recursive-function, it worked well, but I want to keep storing all the outputs in 1 cell structure, is it possible?

Best Answer

Yes. There is no limitation on the number of outputs for recursive function.
Related Question