Printing function results to the Workspace
Show older comments
So I have a simple function
function range(x,y)
%Finds the range between x and y
y-x
When I run the function, I would like the result to output to the workspace. If I run:
range(4,5)
ans =
1
So i want the Workspace to then show "Range" with Value = 1
My first thought was to type
range_a = range(4,5)
but it responds with:
??? Error using ==> range Too many output arguments.
Any ideas would be greatly appreciated!
Accepted Answer
More Answers (1)
Fangjun Jiang
on 6 Apr 2011
change your function definition
function out=range(x,y)
out=y-x;
Categories
Find more on String Parsing 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!