print numbers to command window

2 Ansichten (letzte 30 Tage)
Jamie Williamson
Jamie Williamson am 16 Sep. 2021
Beantwortet: Chunru am 16 Sep. 2021
I have 3 values i wish to print to the command window in engineering convention form. How can this be done??
Values
A = 0 N
B = 206.4188 N
C = -130.5507 N

Akzeptierte Antwort

Chunru
Chunru am 16 Sep. 2021
With mapping toolbox, you can use angl2str. doc angl2str for more details.
A = 0;
B = 206.4188;
C = -130.5507;
A1 = angl2str(A, 'ns', 'degrees')
A1 = ' 0.00^{\circ} '
B1 = angl2str(B, 'ns', 'degrees')
B1 = ' 206.42^{\circ} N '
C1 = angl2str(C, 'ns', 'degrees')
C1 = ' 130.55^{\circ} S '
% If you want to omit ^{\circ}
C1 = strrep(C1, '^{\circ}', '')
C1 = ' 130.55 S '

Weitere Antworten (0)

Produkte


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by