The misalignment is the result of a non-monospaced font type used in the listbox. The default font for a listbox is MS SansSerif, while the default font for the Command Window is Courier; a monospaced font.
To align the text, change the 'FontName' property for the listbox to Courier as shown in the example below:
h = uicontrol('style','listbox','string',x,'position',[20 20 100 100],'FontName','courier')
Best Answer