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 CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by