12.07.2015 Views

MATLAB Function Reference (Volume 2: Graphics)

MATLAB Function Reference (Volume 2: Graphics)

MATLAB Function Reference (Volume 2: Graphics)

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

textwrapPurpose2textwrapReturn wrapped string matrix for given uicontrolSyntaxDescriptionoutstring = textwrap(h,instring)[outstring,position] = textwrap(h,instring)outstring = textwrap(h,instring) returns a wrapped string cell array,outstring, that fits inside the uicontrol with handle h. instring is a cell array,with each cell containing a single line of text. outstring is the wrapped stringmatrix in cell array format. Each cell of the input string is considered aparagraph.[outstring,position]=textwrap(h,instring) returns the recommendedposition of the uicontrol in the units of the uicontrol. position considers theextent of the multiline text in the x and y directions.ExamplePlace a textwrapped string in a uicontrol:pos = [10 10 100 10];h = uicontrol('Style','Text','Position',pos);string = {'This is a string for the uicontrol.','It should be correctly wrapped inside.'};[outstring,newpos] = textwrap(h,string);pos(4) = newpos(4);set(h,'String',outstring,'Position',[pos(1),pos(2),pos(3)+10,pos(4)])See Alsouicontrol2-522

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!