-
13 Comments
It works, but it's ugly :-)
Nice! :)
Never realized that MATLAB sees a defined assignment (y = 2*x) different than no assignment (2*x => assignment to ans).
If anything, I would have guessed the second would be (slightly) more effort.
does this variable "ans" overrides MATLAB's default "ans"?
ok, i got there in the end. but it defeats the rules - there is no "y" variable when you change the template to ans = times2(x)...
how do you know what the rules are?!?
comment section gives a great info
comments really help! lol
David Amor, the rules specify that you have to assign it to a "y" variable. You just need to do
y = times2(x);
Great!
Hi Dirk, can you pls tell me how you got size 10 ?
To get size 10 you have to change y to ans:
function ans = times2(x)
2*x;
end
Nice solution!
nice solution
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!