I have written a function to try to output some key observations about some base data (X,Y). I calculate the r, r2, f-test etc. from the data including calling in the built-in function 'stats'. Code as:
function [r,r2 h,p,ci,stats] = R2Ftest( X, Y )
rsquared = num2str(r2);
h = vartest2(X,Y)
[h,p,ci,stats] = vartest2(X,Y,'Alpha',0.01)
Now, everything outputs nicely in my command window, but really I want to have this information output as variables in my workspace that I can subsequently save.
I know I want to avoid using 'global' (I've read enough about this), and thought I had assigned the output arguments as I wanted - but no joy. So, any thoughts on the fix for this?
Thanks in advance.