function result = PlayerOffersHelper(indata,trial,player) data = indata{trial,5}; % assign result dynamically s = size(data); s = s(1); counter2 = 1; result = zeros(1,3); for counter = 1:s if data(counter,3) == player % col 1 gets timestamp result(counter2,1) = data(counter,1) / 1000; % col 2 gets offer size (cut off at 10) if data(counter,4) > 10 result(counter2,2) = 10; else result(counter2,2) = data(counter,4); end % col 3 gets the price for that person's good result(counter2,3) = data(counter,5) / data(counter,4); counter2 = counter2 + 1; end end