The message string in the message box is actually created using the text
function, i.e., it is positioned by two coordinates (neglecting the z-coordinate). To position it with the alignment right, you'll need to get the position
of the message box and use its width
argument to define the x position of the message text:
h = msgbox('Sample Text');
th = findall(0, 'Tag','MessageBox' );
boxPosition = get(h,'position');
textPosition = get(th, 'position');
set(th, 'position', [boxPosition(3) textPosition(2) textPosition(3)]);
set(th, 'HorizontalAlignment', 'right');
Since this puts your text exactly to the right border of the box, you'll need to adjust the text slightly to the left:
set(th, 'position', [boxPosition(3).*0.95 textPosition(2) textPosition(3)]);
th
to Hebrew one, like Davidset(th, 'FontName', 'David')
just change the font without changing the alignment.