Playing around with stock selection algorithm, hit this thousands of times any idea how to vectorise this. Any help appreciated.
function distances = calDistances(stocks, geneVector, dayN)defaultNoData = 100;distances(length(stocks)) = 100;% Calculate Distances
for stockN = 1 : length(stocks) % Get Stock Vector
stockVector = stocks(stockN).getStockVector(dayN); % No Stock Data Check
if not(isnan(stockVector)) % Euclidian Distance
distances(stockN) = norm(stockVector - geneVector); else % Default no data
distances(stockN) = defaultNoData; endend
Best Answer