function Error: Function definitions are not permitted in this context@@
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentar
Walter Roberson
am 24 Feb. 2014
Which line is it complaining about?
Are you sure that this was not proceeded by a "function" line ?
Antworten (0)
Siehe auch
Kategorien
Mehr zu Shifting and Sorting Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!