필터 지우기
필터 지우기

Help!!! Can't figure out this error

조회 수: 1 (최근 30일)
liu James
liu James 2016년 11월 25일
답변: dbmn 2016년 11월 25일
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

답변 (1개)

dbmn
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');

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by