Dear Matlab Community,
Thanks for years of answering questions via google. I'm afraid I've come across the un-googleable though-
I'm desperate for help to get variables from function variable space into cftool for editing without exiting the function.
1) I've a function (called by button press from GUI) which makes a bunch of readings via a sensor for calibration.
2) I want to import these readings into cftool (curve fitting tool), so I can manually fit and save a fit function to apply later to other data (as final part of function).
But, cftool only takes import data from workspace variables... And no matter what I do, I cannot get the variables in the function variable space into the workspace and get cftool to see them. Example function below:
function blah=testgetvar(a,b,c)
global x;
global y;
x=1:100;
y=x.*a+b.*rand(1,100)+c*ones(1,100);
assignin('base','var1',x);
assignin('base','var2',y);
save('testvar1.mat','x');
save('testvar2.mat','y');
load testvar1;
load testvar2;
cftool
pause;
blah=1;
Things I've tried:
- assignin doesn't save variables into workspace until function exits. I can't call assignin from inside another function. It doesn't work as a work-around.
-saving and loading variables. I think it gets loaded into variable space.
- declaring variables in function as global doesn't seem to work either.
Sincerely Thanks in advance,
-Chris