format long does not work in a function

11 Ansichten (letzte 30 Tage)
marziye ghasemi
marziye ghasemi am 26 Nov. 2018
Beantwortet: Steven Lord am 27 Nov. 2018
i have a function and i need the calculation in long format , i added :
origFormat = get(0, 'format');
format('long');
% -- Work in long format --
set(0,'format', origFormat);
at first line but it doesnt work
  1 Kommentar
Stephen23
Stephen23 am 26 Nov. 2018
Bearbeitet: Stephen23 am 26 Nov. 2018
"at first line but it doesnt work"
What do you expect this to do, and how did you test it?
What does "Work in long format" mean exactly?
Does your code display anything in the command window?

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Steven Lord
Steven Lord am 27 Nov. 2018
The format function changes how double and single precision numbers are displayed. It has no impact on how computations are performed with those numbers, nor will it affect how sym expressions are displayed. To affect how sym expressions are displayed call vpa on the expressions.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by