Clear Filters
Clear Filters

How to fix table display/alignment in command window

21 views (last 30 days)
MATLAB seems to format printing of tables poorly on macs.
Here's a simple example using 2023b on my M1 mac:
dt = datetime('now');
dt2 = datetime('now');
test = "test";
t = table(dt,dt2,test)
The result looks like this. Note the poor column alignment. Also if you try and select the column names the text bolding disappears and the letters shift slightly, especially ones further to the right (hard to see in this example, but noticeable with longer tables).
In contrast this is what it looks like on Windows, nice and aligned!
Is there a setting to toggle to fix this? If not any chance this can get fixed before the official 2024a release (haven't tried the prerelease). I'll note I upgraded to 2023b from 2022a? or some older version to see if that fixed the problem (above example is from 2023b so the newer version did not fix the problem).
Steven Lord
Steven Lord on 20 Mar 2024
What font are you using for Command Window? Follow the instructions on this documentation page to determine which font you're using.
Jim Hokanson
Jim Hokanson on 20 Mar 2024
That fixed it, thanks! My "use system font" was unchecked but the selected font was Lucida Grande (which appears to be the system font). I'm not sure if this is dependent on what OS I installed under (just upgraded to Sonoma from something -- not sure when the upgrade came relative to 2023b install, or what the previous OS version was, I had been delaying for a year or two). Changing this to monospaced, like the editor was already using, fixed the problem. I tend not to mess with the fonts on my machines. Is using the system font the default behavior? I'll note the one Windows machine I'm looking at now is using the system font and the system font is Segoe UI, which apparently in the version MATLAB is using is monospaced. Not sure if that's something worth having someone look into whether the default on mac OS is set to a monospaced font ....

Sign in to comment.

Accepted Answer

Jim Hokanson
Jim Hokanson on 20 Mar 2024
It appears that the table display algorithm assumes monospaced fonts. Changing the "Dekstop Text Font" (Home tab => Preferences => Fonts) to monospaced fixed the issue. You may need to uncheck "use system font" prior ro selecting the monospaced font. Again do this for the bottom panel ("Desktop text Font") to change the font being used by the command window.

More Answers (0)


Find more on Environment and Settings in Help Center and File Exchange




Community Treasure Hunt

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

Start Hunting!