I’m trying to present a msgbox in MATLAB which uses horizontal text alignment ‘right’.
Problem is when I’m changing the text alignment, the message text appears out of the box.
h = msgbox('Sample Text');
th = findall(0, 'Tag','MessageBox' );
set(th, 'HorizontalAlignment', 'right');
Does anyone know to present the user with right-to-left message from Matlab?
The message string in the message box is actually created using the
textfunction, i.e., it is positioned by two coordinates (neglecting the z-coordinate). To position it with the alignment right, you’ll need to get thepositionof the message box and use itswidthargument to define the x position of the message text:Since this puts your text exactly to the right border of the box, you’ll need to adjust the text slightly to the left: