Why does my code result in unlimited ans = 1, when that is not in my code?
Show older comments
I am trying to get the result of righton, lefton, and input, but when I run the code it creates unlimited ans = 1. When I stop the code with ctrl+c I end up getting the answer I want. Why does "Ans = 1" show up when there is no "Ans" in my code? Here is a picture of my code. my code. Thanks in advance for your help!

2 Comments
per isakson
on 18 Mar 2014
Edited: per isakson
on 18 Mar 2014
Your question is too hard for me to read, please markup!
The reason for ans = 1 is often that a function call without an ending ";" returns a logical true/false. ans is a special creature, which is created automatically.
Jake Burger
on 18 Mar 2014
Accepted Answer
More Answers (0)
Categories
Find more on Scripts 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!