Home > data-analysis > manip > cstream > cstream_equal_length.m

cstream_equal_length

PURPOSE ^

SYNOPSIS ^

function [ cstream1 cstream2] = cstream_equal_length(cstream1, cstream2)

DESCRIPTION ^

 the function takes two cstreams that have different lengths and append 0
 on the shorter one so that the two new cstreams have the same length 

 Input: two cstream2
 Output: two new cstreams with the same length

 If two cstreams have different lengths, this function will pad 0 values
 to the shorter one, so that the two will have the same length.
 this operation is needed in the other to do some pairwise calculations.
 For example, calling cstream_shared to find the shared moments

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [ cstream1 cstream2] = cstream_equal_length(cstream1, cstream2)
0002 %
0003 % the function takes two cstreams that have different lengths and append 0
0004 % on the shorter one so that the two new cstreams have the same length
0005 %
0006 % Input: two cstream2
0007 % Output: two new cstreams with the same length
0008 %
0009 % If two cstreams have different lengths, this function will pad 0 values
0010 % to the shorter one, so that the two will have the same length.
0011 % this operation is needed in the other to do some pairwise calculations.
0012 % For example, calling cstream_shared to find the shared moments
0013 %
0014 %
0015 %
0016 
0017 length1 = size(cstream1,1);
0018 length2 = size(cstream2,1);
0019 if (length1 > length2)
0020     cstream2(length2:length1,1) = cstream1(length2:length1,1);
0021     cstream2(length2:length1,2) = 0; 
0022 else
0023     cstream1(length1:length2,1) = cstream2(length1:length2,1);    
0024     cstream1(length1:length2,2) = 0; 
0025 end;

Generated on Wed 24-May-2017 00:00:56 by m2html © 2005