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

1 回表示 (過去 30 日間)
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);

採用された回答

MathWorks Support Team
MathWorks Support Team 2009 年 6 月 27 日
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 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by