How to Keep a Character in A Fixed Position?
1 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
Chad Greene
2017-3-17
编辑:Chad Greene
2017-3-17
Try this:
A = 1;
sprintf('% 8d',A)
B = 1234567;
sprintf('% 8d',B)
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Characters and Strings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!