Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Plot graph with X-axis of hours

Subject: Plot graph with X-axis of hours

From: or

Date: 18 Aug, 2010 07:09:28

Message: 1 of 6

Hi,

I want to plot graph where the X-axis starts from a certain starting hour(i.e. 16:23) until a certain stop hour (i.e. 23:12), is it possible to do this with Matlab?

Thanks,

Or.

Subject: Plot graph with X-axis of hours

From: TideMan

Date: 18 Aug, 2010 07:30:00

Message: 2 of 6

On Aug 18, 7:09 pm, or <orbie...@yahoo.com> wrote:
> Hi,
>
> I want to plot graph where the X-axis starts from a certain starting hour(i.e. 16:23) until a certain stop hour (i.e. 23:12), is it possible to do this with Matlab?
>
> Thanks,
>
> Or.

Sure, why not?

Subject: Plot graph with X-axis of hours

From: or

Date: 18 Aug, 2010 18:13:05

Message: 3 of 6

when I try to do this, i can start from a certain hour but the axis is in decimal scale (i.e. 4.5 in the graph equals 4:30 in hours, and after 4.59 for example i get 4.6 and so on till 4.99 and then 5) how can i get an axis with a minute scale not decimal?

Subject: Plot graph with X-axis of hours

From: Sean

Date: 18 Aug, 2010 18:43:21

Message: 4 of 6

or <orbiener@yahoo.com> wrote in message <1577726502.25421.1282155215300.JavaMail.root@gallium.mathforum.org>...
> when I try to do this, i can start from a certain hour but the axis is in decimal scale (i.e. 4.5 in the graph equals 4:30 in hours, and after 4.59 for example i get 4.6 and so on till 4.99 and then 5) how can i get an axis with a minute scale not decimal?

How about this

%
T = reshape(bsxfun(@plus,[400:100:2300].',[0:59]).',1,[])

If you want hours as integers divide the whole thing by 100. I.e.
T = reshape(bsxfun(@plus,[400:100:2300].',[0:59]).',1,[])/100

Subject: Plot graph with X-axis of hours

From: Sean

Date: 18 Aug, 2010 18:47:08

Message: 5 of 6

"Sean " <sean.dewolski@nospamplease.umit.maine.edu> wrote in message <i4h9k9$dng$1@fred.mathworks.com>...
> or <orbiener@yahoo.com> wrote in message <1577726502.25421.1282155215300.JavaMail.root@gallium.mathforum.org>...
> > when I try to do this, i can start from a certain hour but the axis is in decimal scale (i.e. 4.5 in the graph equals 4:30 in hours, and after 4.59 for example i get 4.6 and so on till 4.99 and then 5) how can i get an axis with a minute scale not decimal?
>
> How about this
>
> %
> T = reshape(bsxfun(@plus,[400:100:2300].',[0:59]).',1,[])
>
> If you want hours as integers divide the whole thing by 100. I.e.
> T = reshape(bsxfun(@plus,[400:100:2300].',[0:59]).',1,[])/100

I worded that weirdly, sorry. If you want only the hours to be integers with decimal minutes divide by 100.

Subject: Plot graph with X-axis of hours

From: Walter Roberson

Date: 18 Aug, 2010 19:57:44

Message: 6 of 6

or wrote:
> when I try to do this, i can start from a certain hour but the axis is in decimal scale (i.e. 4.5 in the graph equals 4:30 in hours, and after 4.59 for example i get 4.6 and so on till 4.99 and then 5) how can i get an axis with a minute scale not decimal?

You may wish to use datetick()

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us