-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathrdmfig.m
39 lines (35 loc) · 1.13 KB
/
rdmfig.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
% Wrapper for rdmplot to create a panel figure.
%
% INPUTS DEF DESCRIPTION
% rdm some pilab-compatible mat, vec or struct array
% names {} cell array of titles for subplots. If undefined we attempt
% to infer from names in input rdm (if struct)
% dims [] dimensions of subplot (we infer if undefined)
% fighand [] existing figure handle (we make a new figure if undefined)
%
% all additional [varargin] are passed on to rdmplot.
%
% [fighand,ax,intmap,cmap] = rdmfig(rdm,names,dims,fighand,varargin)
function [fighand,ax,intmap,cmap] = rdmfig(rdm,names,dims,fighand,varargin)
rdmat = asrdmmat(rdm);
nrdm = size(rdmat,3);
if ieNotDefined('names')
if isstruct(rdm)
names = {rdm.name};
else
names = mat2strcell(1:nrdm,'rdm %02d');
end
end
if ieNotDefined('dims')
dims = ceil(sqrt(nrdm)) .* [1 1];
end
if ieNotDefined('fighand')
fighand = figurebetter('large');
else
figure(fighand);
end
for n = 1:nrdm
ax(n) = subplot(dims(1),dims(2),n);
[ax(n),intmap{n},cmap{n}] = rdmplot(ax(n),rdmat(:,:,n),varargin{:});
title(ax(n),stripbadcharacters(names{n},' '));
end