Subversion Repositories lagranto.ecmwf

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 michaesp 1
function output = col_load(coltable, spacing, shift, varargin)
2
% Routine handles colortable
3
%
4
% coltable  input    string contains ctb-file and its path
5
%                    e.g. /home/user/matlab/.../file
6
%
7
%                    if only file: path = /home/mischa/matlab/ctb/
8
% 
9
% date2     input    shifter for colortable
10
% 
11
% varargin  input    pointer to define a white space                 
12
%                  
13
% output    output   nothing
14
% 
15
% ----------------------------------------------------------
16
%                            Mischa Croci Maspoli (Oct 2004)
17
% ----------------------------------------------------------
18
 
19
%check if varargin = 1
20
if length(varargin) == 1
21
 white=varargin{1};
22
end
23
if length(varargin) == 0
24
 white=0;
25
end
26
 
27
 
28
ctbdefault = '/usr/local/matlabtools/ive_ct/';
29
 
30
 
31
% read colortable
32
if coltable(1) == '/'
33
 ivecol = load(coltable,'-ascii');
34
else
35
 ivecol = load([ctbdefault coltable],'-ascii');
36
end
37
 
38
% devide values by 255
39
ivecol = 1./255.*ivecol;
40
 
41
%ivecol=flipdim(ivecol,1);
42
 
43
% number of colors
44
ncol=length(spacing)-2;
45
 
46
% shifter
47
shcol=shift;
48
 
49
% define white space
50
if  length(varargin) == 1
51
  newmap = ivecol(shcol:ncol+shcol,:);
52
  newmap(white,:) = 1.;
53
else
54
  newmap = ivecol(shcol:ncol+shcol,:);
55
end
56
 
57
%data=[1:ncol+1;1:1:ncol+1]';
58
colormap(newmap(:,:));