Help!!! Can't figure out this error
조회 수: 1 (최근 30일)
이전 댓글 표시
I'm getting this error when I run the plot. "There is no DatetimeTickFormat property on the Line class." I'm trying to have x axis show the dates rather than the serial date number. Please Help
MATLAB code
if
fts1 = fints(Time,Data,{'Open','High','Low','Close'})
high = fts2mat(fts1.High)
dates=datenum(Time,'yyyy/mm/dd')
window_size=20;
output=tsmovavg(high,'s',window_size,1);
plot(dates,output,'DatetimeTickFormat','dd-MMM-yyyy');
end
댓글 수: 0
답변 (1개)
dbmn
2016년 11월 25일
There are two solutions to your problem
a) choose a format other than datenum for your dates variable, f.ex.
dates = datetime(Time,'InputFormat','yyyy/MM/dd');
b) keep the data the same but fiddle with the xlabel property
myAx = gca; % or via plothandle.Parent
n = 5; % user each n-th element
myAx.XTick = dates(1:n:end);
myAx.XTickLabel = datestr(dates(1:n:end), 'yyyy/MM/dd');
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!