Output result's format?
Ältere Kommentare anzeigen
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!
1 Kommentar
Stephen23
am 6 Feb. 2021
The variables EVfiT and EVfiT1 are symbolic or character or possibly some custom class... they are certainly not numeric, so the format command is totally irrelevant.
Akzeptierte Antwort
Weitere Antworten (1)
darova
am 30 Jan. 2021
try double
a = 2;
b = 1/sym(a);
c = b/a
double(c)
3 Kommentare
Steven Lord
am 31 Jan. 2021
If double doesn't work because the symbolic expression contains a symbolic variable use vpa.
ErikJon Pérez Mardaras
am 4 Feb. 2021
Walter Roberson
am 6 Feb. 2021
"format" is a command, not a local setting for functions or subroutines.
If you had a
disp('hello')
command inside a function, would you expect the output of the function to disappear from the command window when the function returned? NO -- you would recognize that disp() changes state permanently, rather than disp() being a local setting within the function. Just so, "format" changes are permanent until changed.
Kategorien
Mehr zu Operations on Strings finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!