-
Notifications
You must be signed in to change notification settings - Fork 0
/
xraster.m
68 lines (62 loc) · 1.51 KB
/
xraster.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
function xraster(z, xstart, xdelta, ystart, ydelta, clims)
% Usage: xraster(z, xstart, xdelta, ystart, ydelta, clims)
%
% Plot an X-Midas style raster
%
% z..........N-by-M array of data to plot
% where N defines the y-axis
% and M the x-axis
%
% xstart.....optional metadata defining the
% starting abscissa value
%
% xdelta.....optional metadata defining the
% spacing between abscissa points
%
% ystart.....optional metadata defining the
% starting ordinate value
%
% ydelta.....optional metadata defining the
% spacing between ordinate points
%
% clims......optional two-element vector of form [cmin cmax]
% to set the data scaling in the colormap
%
if nargin < 6 || isempty(clims)
clims = [];
end
if nargin < 5 || isempty(ydelta)
ydelta = 1;
end
if nargin < 4 || isempty(ystart)
ystart = 1;
end
if nargin < 3 || isempty(xdelta)
xdelta = 1;
end
if nargin < 2 || isempty(xstart)
xstart = 1;
end
if nargin == 0 || isempty(z)
help xraster
return
end
if isoctave
if size(z,1) > 9999
fprintf(2, 'Max number of rows (9999) exceeded: %d. Plotting first 9999 rows only.\n', size(z,1));
z = z(1:9999,:);
end
end
if ~isreal(z)
z = abs(z);
end
sz = size(z);
num_frames = sz(1);
frame_size = sz(2);
x = xstart + (0:xdelta:xdelta*(frame_size-1));
y = ystart + (0:ydelta:ydelta*(num_frames-1));
if isoctave || ~isempty(clims)
imagesc(x,y,z,clims);
else
imagesc(x,y,z);
end