How to add the variables in a function to your workspace?
5 views (last 30 days)
Show older comments
azarang asadi on 18 Mar 2020
Commented: Adam Danz on 19 Mar 2020
So I have a function let's say like this y = fun(x) and to get the y from x, I am defining some other variables let's say like c, that I need to first compute and put it in another formula to compute y. ( F= ma , and my y here is F and my c here is a) .So my question is that how I can see what the values of c are and add it as a variable in the workspace?
Edited: Adam Danz on 19 Mar 2020
Add the variable as an output.
function [y, c] = fun(x)
c = . . .
y = . . .
If you only want one of the outputs when calling the function,
y = fun(x);
[~, c] = fun(x);
Find more on Whos in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!