How to plot with repeating values in the abscissa vector?

I took a bunch of readings over the course of three days and used the "now" function to timestamp each reading. Plotting that isn't good to look at, because the x values are all 7.36e+05.
I was thinking I'd change that to hours. I wanted to have the following x vector:
x = repmat(0:23,[1 numDays])
How do I make a scatter plot of my data and have that as my abscissa, without Matlab just plotting multiple points at each hour?

 채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2015년 7월 13일
x=1:48
y=sin(0.1*x)
h=scatter(x,y)
set(gca,'xtick',x,'xticklabel',arrayfun(@num2str,0:23,'un',0))

댓글 수: 1

It worked on the sin wave example. It did not transfer to my data for some reason. I'll fiddle around with it and get it to work. Thanks for the helpful tip!
George

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 MATLAB에 대해 자세히 알아보기

태그

질문:

2015년 7월 13일

댓글:

2015년 7월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by