function Error: Function definitions are not permitted in this context@@
6 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
for calcstatsidx = 1:size(stockReturn,2)
stockStats(calcstatsidx).Stock = stockReturn(calcstatsidx).Stock;
annualizedReturn = stockReturn(calcstatsidx).Return .* annualizemultiplier;
stockStats(calcstatsidx).sampleSize= size(annualizedReturn,1)/numOfBucketsInADay;
stockStats(calcstatsidx).mean = nanmean(annualizedReturn);
stockStats(calcstatsidx).median = nanmedian(annualizedReturn);
stockStats(calcstatsidx).standardDeviation = nanstd(annualizedReturn);
stockStats(calcstatsidx).medianAbsoluteDevation = mad(annualizedReturn,1);
stockStats(calcstatsidx).skew = skewness(annualizedReturn,0);
stockStats(calcstatsidx).kurtosis = kurtosis(annualizedReturn,0);
sorted = sort(annualizedReturn);
if size(sorted, 1)>=10
stockStats(calcstatsidx).max10 = sorted(end-9: end);
stockStats(calcstatsidx).min10 = sorted(1:10);
else
stockStats(calcstatsidx).max10 = sorted;
stockStats(calcstatsidx).min10 = sorted;
end
end
The variable "stockStats" change size in every loop iteration. Consider preallocating for speed"!
Thank you for any helps!
1 Commento
Walter Roberson
il 24 Feb 2014
Which line is it complaining about?
Are you sure that this was not proceeded by a "function" line ?
Risposte (0)
Vedere anche
Categorie
Scopri di più su Shifting and Sorting Matrices in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!