Filter löschen
Filter löschen

How to Keep a Character in A Fixed Position?

2 Ansichten (letzte 30 Tage)
Rightia Rollmann
Rightia Rollmann am 17 Mär. 2017
Bearbeitet: Chad Greene am 17 Mär. 2017
I have created a Static Text that shows the current values of A and B:
A: 1 B: 2
When A’s value has more than one digit, it pushes B forward, and therefore B is no longer in its previous location:
A: 1234567 B: 2
Is there any trick to hold B in a fixed position regardless of the number of A’s digits? So it would like that:
A: 1 B: 2
A: 1234567 B: 2

Antworten (1)

Chad Greene
Chad Greene am 17 Mär. 2017
Bearbeitet: Chad Greene am 17 Mär. 2017
Try this:
A = 1;
sprintf('% 8d',A)
B = 1234567;
sprintf('% 8d',B)

Kategorien

Mehr zu Characters and Strings finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by