function [out] = Multiplex2Signals( one, two, colFlg ) % colFlg: 0 => out is the rows of one & two multiplexed. % 1 => out is the cols of one & two multiplexed. % % 22 Jan 2009 D.Bozarth, SSU Engineering Science % if ~colFlg sz1 = size(one, 1); sz2 = size(two, 1); else sz1 = size(one, 2); sz2 = size(two, 2); end lim = sz2; if sz1 < sz2; lim = sz1; end out = []; for j = 1:lim if ~colFlg out = [out; one(j, :); two(j, :)]; else out = [out one(:, j) two(:, j)]; end end % Get stragglers. if lim < sz1 for j = (lim+1):sz1 if ~colFlg out = [out; one(j, :)]; else out = [out one(:, j)]; end end else for j = (lim+1):sz2 if ~colFlg out = [out; two(j, :)]; else out = [out two(:, j)]; end end end