-
Notifications
You must be signed in to change notification settings - Fork 9
/
chart.m
executable file
·49 lines (43 loc) · 1.17 KB
/
chart.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
function chart( fontname )
% CHART Show ANSI-chart like display of characters MATLAB can produce.
% CHART( 'fontname' ) will through 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