%% borrowed from the tutorial

function outputData = standardize(rawData) 

rawData = rawData';

    % get number of rows and columns in rawData
[rows,cols ] = size(rawData);
    % initially set outputData to rawData
outputData = rawData;
        % for each element in outputData subtract the row’s mean and divide by the standard deviation
for i = 1:rows
    rowMean = mean( rawData(i, :) );
    rowSTD = std ( rawData(i, : ));
    
    %% handling std = 0
    if rowSTD == 0
        rowSTD = 1;
    end
    
    for j = 1: cols
        outputData(i,j) = ( rawData(i,j) - rowMean ) / rowSTD;
    end
end

outputData = outputData';