Why do I get an error while plotting a Financial Time Series which includes a NaN input in the Financial Time Series Toolbox?

1 vue (au cours des 30 derniers jours)
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);

Réponse acceptée

MathWorks Support Team
MathWorks Support Team le 27 Juin 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.

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by