Home > vbmeg > functions > tool_box > dynamics_movie > test_fig > basic_tool > get_col_from_val.m

get_col_from_val

PURPOSE ^

get color from value

SYNOPSIS ^

function col = get_col_from_val(val,minmax,cmap)

DESCRIPTION ^

 get color from value  

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function    col = get_col_from_val(val,minmax,cmap)
0002 % get color from value
0003 %
0004 % Copyright (C) 2011, ATR All Rights Reserved.
0005 % License : New BSD License(see VBMEG_LICENSE.txt)
0006 
0007 vmin = minmax(1);
0008 vmax = minmax(2);
0009 
0010 N = size(cmap,1);
0011 
0012 val = max(val,vmin);
0013 val = min(val,vmax);
0014 
0015 I = (N-1)*(val-vmin)/(vmax-vmin) + 1;
0016 col = cmap(fix(I),:);

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005