Why do I get an error while plotting a Financial Time Series which includes a NaN input in the Financial Time Series Toolbox?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Why do I get an error while plotting a Financial Time Series which includes a NaN input in the Financial Time Series Toolbox v1.1 (R12.1)?
The following lines of code cause an error in version 1.1 of the Financial Time Series Toolbox:
dailydates = (today-2000:today)';
dates = unique(eomdate(year(dailydates),month(dailydates)));
data = ones(size(dates)) * NaN;
temp = fints(dates,data,'fts','d','NaNs');
h = plot(temp,'-');
??? Error using ==> plot
Vectors must be the same lengths.
Error in ==> D:\Applications\MATLAB\toolbox\ftseries\ftseries\@fints\plot.m
On line 177 ==> hp = plot(ftsa_dates, ftsa_plotdata, linefmt);
This error only occurs when a plotting option is selected. The following code will not cause the error:
dailydates = (today-2000:today)';
dates = unique(eomdate(year(dailydates),month(dailydates)));
data = ones(size(dates)) * NaN;
temp = fints(dates,data,'fts','d','NaNs');
h = plot(temp);
Akzeptierte Antwort
MathWorks Support Team
am 27 Jun. 2009
This is a bug in the Financial Time Series Toolbox v1.1 (R12.1) that has been fixed in the Financial Time Series Toolbox 2.0 (R13).
If you are still using version 1.1 of the Toolbox, one workaround, would be to not plot financial time series with a plotting option.
As a secondary workaround, you can add the following code between lines 172 and 173 of MATLAB_ROOT\toolbox\ftseries\@fints\plot.m:
else,
ftsa_plotdata = ftsa_data(:, :);
plot_legend = ftsa.names(4:end);
This seems to solve the problem as well.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!