Matlab API
function [Y] = PickPeriodicValues( X, m, n, p, q )
% Return the sub-matrix composed of all chosen cells
% Periodic specification: m, n specify the rows; p, q specify the columns.
% If m or n contains 0, then all rows are specified.
% If p or q contains 0, then all cols are specified.
% The intersection of the row spec & col spec, is chosen.
% Example:  m=3, n=4 => The 3rd row in each group of 4 rows is specified.
%           p=2, q=6 => The 2nd col in each group of 6 cols is specified.
%           The returned matrix contains:
%           (3, 2), (3, 8), ...
%           (7, 2), (7, 8), ... etc.
%
% 15 Jan 2009 - D.Bozarth
% 16 Jan Allow m, p to be vectors.
%

function [Y] = CollectOddEvenRows( X, oddFlg )
% Return the matrix transformed so that the rows are grouped as
% .. all even-numbered rows, and all odd-numbered rows.
% oddFlg:   0 => even-numbered rows are on top
%           1 =>  odd-numbered rows are on top
%
% 14 Jan 2009 - D.Bozarth
%

function [R] = Correlate2D(fiRe, fiIm, foRe, foIm, w, intFlg, polFlg, n)
fiIm = ''; % The math didn't work well with complex values.
% Generate an n x n matrix representing R(0) through R(n-1)
% .. (shift correlations)
% .. for the rows and columns of the matrix represented in fileIn.
%
% Due to D.Salomon, "Correlation in Statistics and in Data Compression" (2000)
% Adapted 12 Jan 2009 D.Bozarth - SSU Engineering Science
% 13 Jan 2009 - Add flag for polar coordinates, enable components
%

function [R] = Correlate2DDisplay3D(csv_name, w, intFlg, n, fig)
% Generate an n x n matrix representing R(0) through R(n-1)
% .. (shift correlations)
% .. for the rows and columns of the matrix contained in "csv_name.csv"
% Display the 3D mesh of the resulting correlation matrix, using Figure(fig).
%
% 16 Jan 2009 D.Bozarth - SSU Engineering Science
%

function Display3D( csv_name, w, intFlg, fig, xstr, ystr, zstr, topstr )
% Display the 3D mesh
% .. for the rows and columns of the matrix contained in "csv_name.csv"
% .. using Figure(fig).
%
% Not yet tested with float inputs. (Actually I think it has. 28 Jan 09)
%
% 18 Jan 2009 D.Bozarth - SSU Engineering Science
%

function [f] = FileIftFromComponents( realIn, imagIn, realOut, imagOut, w, intFlg )
% Stores in the specified output text files
% .. the Inverse Fourier Transform of the 2-dim array represented in the
% .. specified input text files. All files are comma-delimited.
%   w is the common width (horizontal dimension) of the source arrays.
%   intFlg: 0 => input values are floats; 1 => input values are integers
%
% 31 Dec 2008 - D.Bozarth, SSU Engineering Science
% 13 Jan 2009 - Add calling argument.
%

function FileSignalAsComponents( realOut, imagOut, signal, intFlg, polFlg )
% Files the the 2-dim array represented in f
% .. as complex components in 2 separate files.
%   h, w are the height, width of the signal array.
%   intFlg: 0 => output values are floats, comma-delimited
%           1 => output values are signed integers, comma-delimited
%           2 => output values are unsigned bytes, comma-delimited
%           3 => output is a binary stream
%   polFlg: 0 => normal operation;
%           1 => If 2 output files, then they receive angle, magnitude.
%                If 1 output file, then it receives magnitude (same as Real).
%                (This maintains consistency with Matlab's syntax.)
%
% 31 Dec 2008 - D.Bozarth, SSU Engineering Science
% 12 Jan 2009 - Allow empty second parameter.
% 13 Jan 2009 - Add flag for polar components.
% 17 Jan 2009 - Add value '2' to intFlg semantics.
% 27 Jan 2009 - Enable binary file output, remove 2 arguments - use size() instead.
%

function [F] = GetFtAsComponents( realOut, imagOut, f, h, w, intFlg )
% Returns the Fourier Transform of the 2-dim array represented in f,
% .. and stores the FT components in comma-delimited text files.
%   h, w are the height, width (as complex values) of the source array.
%   intFlg: 0 => output values are floats; 1 => output values are integers
%
% 18 Dec 2008 - D.Bozarth, SSU Engineering Science
% 13 Jan 2009 - Add calling argument.
%

function [X] = GetIftFromComponents( realIn, imagIn, w, intFlg )
% Returns the Inverse Fourier Transform of the 2-dim array represented in the
% .. specified source text files, which should be comma- or tab-delimited.
%   w is the common width (horizontal dimension) of the source arrays.
%   intFlg: 0 => input values are floats; 1 => input values are integers
%
% 02 Jan 2009 - D.Bozarth, SSU Engineering Science
% 13 Jan 2009 - Add calling argument.
%

function [X] = GetSignalFromComponents( realIn, imagIn, w, intFlg, polarFlg )
% Returns the signal represented in the
% .. specified source text files.which should be comma- or tab-delimited.
%   w is the common width (horizontal dimension) of the source arrays.
%   intFlg: 0 => input values are floats, comma- or tab-delimited.
%           1 => input values are integers, comma- or tab-delimited.
%           2 => (Reserved)
%           3 => input is a binary stream
%   polarFlg:  0 => normal operation;
%              1 => If 2 input files, then they contain angle, magnitude.
%                   If 1 input file, then it contains magnitude (same as Real).
%                   (This maintains consistency with Matlab's syntax.)
%
% 18 Dec 2008 - D.Bozarth, SSU Engineering Science
% 12 Jan 2009 - Allow empty second parameter.
% 13 Jan 2009 - Add polarFlg.
% 14 Jan 2009 - Fix bug in my usage of pol2cart.
% 27 Jan 2009 - Enable binary file input.
%

function [v] = MatrixToVector( X )
% X is a 2D matrix.
% Returns v as the concatenated sequence of rows of X.
%
% 27 Jan 2009 - D.Bozarth, SSU Engineering Science
%

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
%

function [Y] = PickPeriodicValues( X, m, n, p, q )
% Return the sub-matrix composed of all chosen cells
% Periodic specification: m, n specify the rows; p, q specify the columns.
% If m or n contains 0, then all rows are specified.
% If p or q contains 0, then all cols are specified.
% The intersection of the row spec & col spec, is chosen.
% Example:  m=3, n=4 => The 3rd row in each group of 4 rows is specified.
%           p=2, q=6 => The 2nd col in each group of 6 cols is specified.
%           The returned matrix contains:
%           (3, 2), (3, 8), ...
%           (7, 2), (7, 8), ... etc.
%
% 15 Jan 2009 - D.Bozarth
% 16 Jan Allow m, p to be vectors.
%

function [X] = VectorToMatrix( v, w )
% v is a row vector
% w is the width of the desired matrix
% Returns X with the number of rows required by v, w
% .. padded with zeros at end if necessary.
%
% 27 Jan 2009 - D.Bozarth, SSU Engineering Science
%