function [  ] = addvartoxls( var, var_name, line_index, filename, measurename )
%UNTITLED2 Summary of this function goes here
%   Detailed explanation goes here
    alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
    var_info = whos(varname(var));
    
    if strcmp(var_info.class, 'cell')
        line_data = {var_name, var{:, :}};
    else
        line_data = {var_name, var(:, :)};
    end

    xlsindex = strcat(alphabet(1), num2str(line_index), ':', alphabet(length(var)+1), num2str(line_index));
    xlswrite(strcat('SimData/', filename), line_data, measurename, xlsindex)

end

