different result of unchanged script after restart of Matlab (symbolic)
1 view (last 30 days)
Show older comments
I have a script with only the following two lines:
syms x
solve(x^2)
If this script is run as first command after starting Matlab the result is:
ans = 0
0
After running some other commands the result of running the same and unchanged script is:
ans =
[1x1 empty sym]
This problem occured during a beginner's course at university. It occured on different computers all running openSuse. Clearing the workspace did not solve the issue.
My question is: Is this a bug or what exactly (other than the workspace) should be cleared or changed to get the expected (first) result?
0 Comments
Answers (1)
Sean de Wolski
on 2 Apr 2015
Whenever you run any command without assigning its output to a variable, the output is assigned to ans
>>5
>>magic(3)
If you want to store it for later, assign it to a variable rather than using the default:
>> x = 5
>> y = magic(3)
See Also
Categories
Find more on Assumptions 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!