Thread Subject: Plot strings

Subject: Plot strings

From: Sean

Date: 26 Sep, 2008 16:04:02

Message: 1 of 3

I want to customize my axis of a plot with a string array of time values. Any ideas how to do this?

time = ['15:14:12','15:14:13','15:14:14','15:14:15'];
value = [ 4.5, 6.5, 10, 4 ];

plot(value);

%% Now i need to set the x axis to be the time values in
%the above array.

Please help.

Subject: Plot strings

From: Richard

Date: 26 Sep, 2008 17:44:02

Message: 2 of 3

You might want to look for the function "format_ticks" in the file_exchange. It may do what you want to do.



"Sean " <winfree.sean@gmail.com> wrote in message <gbj15i$4so$1@fred.mathworks.com>...
> I want to customize my axis of a plot with a string array of time values. Any ideas how to do this?
>
> time = ['15:14:12','15:14:13','15:14:14','15:14:15'];
> value = [ 4.5, 6.5, 10, 4 ];
>
> plot(value);
>
> %% Now i need to set the x axis to be the time values in
> %the above array.
>
> Please help.

Subject: Plot strings

From: Walter Roberson

Date: 26 Sep, 2008 16:55:09

Message: 3 of 3

Sean wrote:
> I want to customize my axis of a plot with a string array of time values.
> Any ideas how to do this?
 
> time = ['15:14:12','15:14:13','15:14:14','15:14:15'];
> value = [ 4.5, 6.5, 10, 4 ];
 
> plot(value);
 
> %% Now i need to set the x axis to be the time values in
> %the above array.

Presuming that time is a cell array -- the expression you show would
have time end up as one long string:

timenums = datenum(time);
plot(timenums, value);
datetick('x, 'HH:MM:SS');

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

Tag Activity for This Thread
Tag Applied By Date/Time
axis Sean 26 Sep, 2008 12:05:05
plot Sean 26 Sep, 2008 12:05:05
rssFeed for this Thread

Contact us at files@mathworks.com