Home > data-vis > supporting_functions > cont2scaled.m

cont2scaled

PURPOSE ^

refactor - downsample data by this amount

SYNOPSIS ^

function out = cont2scaled(subid, varname, refactor, maxval, nbins, rgb1, rgb2)

DESCRIPTION ^

 refactor - downsample data by this amount
    suggested value : 5
 maxval - upper bound, represented by the darkest color
    suggested values :
       object size, 10
       motion pos-speed, 150
 nbins - resolution of color space, i.e., number of distinct colors used
    suggested value : 50
 rgb1 - color representing minimum value
    suggested value : [1 1 1]
 rgb2 - color representing the maximum value
    suggest value:
       [1 0 0] for obj3
       [0 1 0] for obj2
       [0 0 1] for obj1
 out is a structure intended for direct input into vis_streams_multiwork function

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function out = cont2scaled(subid, varname, refactor, maxval, nbins, rgb1, rgb2)
0002 % refactor - downsample data by this amount
0003 %    suggested value : 5
0004 % maxval - upper bound, represented by the darkest color
0005 %    suggested values :
0006 %       object size, 10
0007 %       motion pos-speed, 150
0008 % nbins - resolution of color space, i.e., number of distinct colors used
0009 %    suggested value : 50
0010 % rgb1 - color representing minimum value
0011 %    suggested value : [1 1 1]
0012 % rgb2 - color representing the maximum value
0013 %    suggest value:
0014 %       [1 0 0] for obj3
0015 %       [0 1 0] for obj2
0016 %       [0 0 1] for obj1
0017 % out is a structure intended for direct input into vis_streams_multiwork function
0018 
0019 out = [];
0020 if has_variable(subid, varname)
0021     data = get_variable(subid, varname);
0022     col2 = data(:,2);
0023     col2(col2 > maxval) = maxval;
0024     col2 = downsample(col2, refactor);
0025 
0026     col2 = round(col2 / maxval * nbins);
0027     col2(col2 == 0) = 1;
0028     x = (linspace(data(1,1), data(end,1), size(col2, 1)))';
0029     data = [x, col2];
0030 %     data = cstream2cevent(data);
0031 
0032     colors = gradcolormap(rgb1, rgb2, nbins);
0033     out.data = data;
0034     out.args.draw_edge = 0;
0035     out.args.colors = colors;
0036     out.args.isCont = 1;
0037 end
0038 end

Generated on Tue 23-May-2017 20:00:55 by m2html © 2005