Graphics | ![]() ![]() |
例題 - 複数行のテキスト
MATLAB は、セル配列を使って、複数行のテキスト文字列をサポートしています。これは、セルに対して1行をもつ一つのセル配列として文字列変数を単に定義するだけです。つぎの例題は、2つのセル配列を定義しています。一つは、uicontrol
に対して使用するもので、他は、text
に対して使用するものです。
str1(1) = {'Center each line in the Uicontrol'}; str1(2) = {'Also check out the textwrap function'}; str2(1) = {'Each cell is a quoted string'}; str2(2) = {'You can specify how the string is aligned'}; str2(3) = {'You can use LaTeX symbols like \pi \chi \Xi'}; str2(4) = {'\bfOr use bold \rm\itor italic font\rm'}; str2(5) = {'\fontname{courier}Or even change fonts'}; plot(0:6,sin(0:6)) uicontrol('Style','text','Position',[80 80 250 65],... 'String',str1); text(5.75,sin(2.5),str2,'HorizontalAlignment','right')
![]() | TeX文字列の中で変数を使用 | グラフに矢印やラインを付加 | ![]() |