MATLAB: How to change the width of a dialog box in MATLAB

boxchangedialoglineMATLABonetext;warndlgwidth

I would like to be able to change the width of a dialog box, for example, one that is created using the WARNDLG function. I have a long line of text and I would like it all to fit in one line in the Warning Dialog box.

Best Answer

The ability to change the width of the warning dialog box so that it displays the text in one line is not available in MATLAB.
A possible workaround is to get the Children of the dialog box. Replace the axes with a text uicontrol whose width can be controlled:
Example:
input={'ddddddddddddssssssssoooooooooooooooooooooooooossssssssssseeeeeeewwwwqqqqqqqqqqqqqqqqqqnnnnnnnnnnnnnnnnnnnnuuuuuuuuuuuuu8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888'};
h = helpdlg(input);
set(0,'ShowHiddenHandles','on');
set(h,'Position',[100,100,500,300]);
ui = get(h,'Children');
delete(ui(2));
y=uicontrol('style','text','string',input,'units','normalized');
set(y,'Position',[.1 .5 .8 .3],'HorizontalAlignment','left');
set(h,'Children',[ui(1) ui(3) y]);