College of Natural Sciences
 
FAQs
This is for IE7 to hold div open

2.2.1.3. How do I get Greek letters in my text objects?

You can obtain Greek characters from the symbol font. To implement:

h=text(x,y,'string')

set(h,'FontName','courier');

or

set(gca,'FontName','symbol');

text(x,y,setstr(num));

where x and y are the coordinates on the graph where you want to place the Greek symbols, and num is the value from the list of 0-255 characters from the symbol font. To display a table of the symbol font, you can use the following M-file called chart.m.

function chart( fontname )

% CHART Show ANSI-chart like display of characters MATLAB

%can produce.

% CHART( 'fontname' ) will put up a figure

% window with all 255

% characters of the named font in a 16x16 grid.

% Close figure when done, it creates 256 text

% objects. You may want

% that memory back!

% Chuck Packard, The Mathworks, Inc., 25 Jan 93

% This is an unsupported, purely for example, M-

% file.

%

%

% TO USE THIS CHART:

% USE SETSTR( VALUE), WHERE VALUE=( (16*XCOORD)+YCOORD)

%

%

% make a new figure and axis

% (I'm assuming you want to keep the current graph in the

% gcf.)

%

figure;

axis([-1 16 -1 16])

ax = gca;

%

%set font to be used

%

set(ax, 'DefaultTextFontName', fontname )

%

%some other Handle Graphics settings, written out in

%full.

%See manual for more info.

%

set(ax, 'YDir', 'Reverse', 'Box', 'on')

set(ax, 'YTick', 0:15, 'XTick', 0:15)

set(ax, 'DefaultTextHorizontalAlignment', 'Center')

set(ax, 'DefaultTextVerticalAlignment', 'Bottom')

%

%not vectorized like all 'good' MATLAB M-files, but

%easier to understand!

%

x = reshape( 0:255, 16, 16 );

for h=1:16

for v=1:16

text(h-1,v-1,setstr(x(v,h)));

end

end