MATLAB: Output result’s format

formatMATLABoutputresultresults

I am executing a great-script which has inside it another mini-scripts.
Those scripts execute mathematical operations in order to calculate and show results of differente variables.
The issue is that Matlab do show those results correctly but some of the in this strange format:
How can I solve this problem and achieve Matlab giving me the results in a normal format? I think that this doesn`t happen if I execute those mini-scripts separately and individualy. It only happens when I execute the great-script. I also have tried writing
format short
In the head of each mini-script but seems that this didn't fix the issue.
Thanks!

Best Answer

These are symbolic expressions you are showing. The format command has NOTHING to do with symbolic expressions. It applies only to numeric values, thus typically double precision numbers.
X = 1 + sqrt(sym('13445664/2424536343636'))
X = 
X
X = 
format short
X
X = 
format rat
X
X = 
As you see, anything I do with format does not touch how we see X.
I cannot replicate what you did, because you show only a picture of your output. (If you really want help, then paste in the actual code, as text.)
But now, if I convert X to a double,
format short
Xd = double(X)
Xd = 1.0024
format rat
Xd
Xd =
1277/1274
format long g
Xd
Xd =
1.00235492336053
Now you see that format works, and it works as designed. I can turn it on and off on a whim. It applies to floating point numbers. The numbers that you show in that picture LOOK like numbers. But format does not understand symbolic expressions. It ignores them.