[dbf0ef]: blockproc / blockfigure.m Maximize Restore History

Download this file

blockfigure.m    50 lines (42 with data), 1.3 kB

 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 p = blockfigure(varargin)
%BLOCKFIGURE Block figure object
% Usage: p=blockfigure();
% p=blockfigure('cm',cmaps);
%
% Output parameters:
% p : JAVA object of the class net.sourceforge.ltfat.SpectFrame
%
% `p=blockfigure()` initializes a JAVA object for the |plotblock|
% routine.
%
% Optional key-value pairs:
%
% `'cm',cmaps` : Custom colormap (a $L \times 3$ matrix) or colormaps
% (cell array of matrixes).
%
definput.keyvals.cm=[];
[flags,kv]=ltfatarghelper({},definput,varargin);
p = [];
try
p = javaObject('net.sourceforge.ltfat.SpectFrame');
catch% err
error(['%s: Could not load net.sourceforge.ltfat.SpectFrame. It is not ',...
'compiled or it is not in Matlab classpath. In the latter case, ',...
'ltfatstart should do the trick.'],upper(mfilename));
end
% Gives p time to be correctly initialized. Otherwise, calling methods
% of the object can fail.
pause(0.1);
if isempty(kv.cm)
% Create a default colormap.
kv.cm = {jet(256)};
elseif isnumeric(kv.cm)
% Enclose the colormap to a single element cell array.
kv.cm = {kv.cm};
elseif iscell(kv.cm)
if numel(kv.cm)>1
error('%s: TO DO: More than one colormap is not supported yet.',upper(mfilename));
end
end
% Set the colormap.
javaMethod('setColormap',p,kv.cm{1});