function result = operation(oper,data1,data2)

 result = [];

if length(data1) ~= length(data2)
    return
end

l      = length(data1);
result = ones(l,1) * NaN;
for n = 1 : l
    if ~isnan(data1(n)) && ~isnan(data2(n))
        switch oper
            case '+'
                result(n) = data1(n) + data2(n);
            case '-'
                result(n) = data1(n) - data2(n);
        end
    elseif ~isnan(data1(n)) && isnan(data2(n))
        result(n) = data1(n);
    elseif isnan(data1(n)) && ~isnan(data2(n))
        result(n) = data2(n);
    end
end

end