Home > data-analysis > manip > cont > cont2cstream.m

cont2cstream

PURPOSE ^

cont2cstream Convert cont data to cstream data

SYNOPSIS ^

function cstream_data = cont2cstream(var_data, param)

DESCRIPTION ^

 cont2cstream  Convert cont data to cstream data     
  USAGE:
    cstream_data = cont2cstream(var_data, param);

    param: 
      param.nseg: the length of the cstream to be generated. (Now it must be divisible by length of var_data) 
      param.alphabet_size: the number of categories/symbols

    Example: 
    cstram_data = cont2cstream(var_data, struct('nseg', size(var_data,1), 'alphabet_size', 16));

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function cstream_data = cont2cstream(var_data, param)
0002 % cont2cstream  Convert cont data to cstream data
0003 %  USAGE:
0004 %    cstream_data = cont2cstream(var_data, param);
0005 %
0006 %    param:
0007 %      param.nseg: the length of the cstream to be generated. (Now it must be divisible by length of var_data)
0008 %      param.alphabet_size: the number of categories/symbols
0009 %
0010 %    Example:
0011 %    cstram_data = cont2cstream(var_data, struct('nseg', size(var_data,1), 'alphabet_size', 16));
0012 %
0013 data = var_data(:,2);
0014 data_len = length(data);
0015 nseg = param.nseg;
0016 alphabet_size = param.alphabet_size;
0017 
0018 % nseg must be divisible by data length
0019 if (mod(data_len, nseg))    
0020     disp('nseg must be divisible by the data length. Aborting ');
0021     return;  
0022 end;
0023 
0024 str = timeseries2symbol(data, data_len, data_len, alphabet_size);
0025 if size(str,1) == 1
0026     str = str';
0027 end
0028 cstream_data = [var_data(:,1), str];

Generated on Tue 23-May-2017 03:00:58 by m2html © 2005