From: ronnie on
hello all,

I have a segment of code that plots a line graph of data that shows varying degrees over a segment of time (few hours during a day)

here is my exact code:

a=xlsread('file1.xlsx', 'A2:A1000');
b=xlsread('file1.xlsx', 'B2:B1000');
A=[a b];

Figure default %calls out default text display on graph

y=A(:,2);
time=A(:,1);
plot(time, y, 'linewidth', 2, 'color', [0.4, 1, 0.4]);
amin = min(time);
amax = max(time);
axis([amin, amax, -180, 180]);

My time data is as follows:
15:33:41
15:33:42
15:33:43
15:33:44
15:33:45... etc.

How do I make my plot display the actual time data and not the decimal value that matlab converts excel time data to on the graph for the x axis?
From: Steven Lord on

"ronnie" <asdfessssy(a)aol.com> wrote in message
news:9817917.15316.1277307974736.JavaMail.root(a)gallium.mathforum.org...
> hello all,
>
> I have a segment of code that plots a line graph of data that shows
> varying degrees over a segment of time (few hours during a day)
>
> here is my exact code:
>
> a=xlsread('file1.xlsx', 'A2:A1000');
> b=xlsread('file1.xlsx', 'B2:B1000');
> A=[a b];
>
> Figure default %calls out default text display on graph
>
> y=A(:,2);
> time=A(:,1);
> plot(time, y, 'linewidth', 2, 'color', [0.4, 1, 0.4]);
> amin = min(time);
> amax = max(time);
> axis([amin, amax, -180, 180]);
>
> My time data is as follows:
> 15:33:41
> 15:33:42
> 15:33:43
> 15:33:44
> 15:33:45... etc.
>
> How do I make my plot display the actual time data and not the decimal
> value that matlab converts excel time data to on the graph for the x axis?

Look at DATETICK.

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com


From: ronnie on
When I have my original code that I posted I added datetick('x', 13);

This code was supposed to work because I tested it on the same set of time data that I was reading in with the original program and a few arbitrary values to put on the Y - axis. The function displays the times in HH:MM:SS just like I want when I test the function.

However, the datetick function (when used with my code) goes to produce the figure but matlab freezes and the figure is unable to be displayed.

Is there anyway to get the datetick function to work around this?
From: us on
ronnie <asdfessssy(a)aol.com> wrote in message <9817917.15316.1277307974736.JavaMail.root(a)gallium.mathforum.org>...
> hello all,
>
> I have a segment of code that plots a line graph of data that shows varying degrees over a segment of time (few hours during a day)
>
> here is my exact code:
>
> a=xlsread('file1.xlsx', 'A2:A1000');
> b=xlsread('file1.xlsx', 'B2:B1000');
> A=[a b];
>
> Figure default %calls out default text display on graph
>
> y=A(:,2);
> time=A(:,1);
> plot(time, y, 'linewidth', 2, 'color', [0.4, 1, 0.4]);
> amin = min(time);
> amax = max(time);
> axis([amin, amax, -180, 180]);
>
> My time data is as follows:
> 15:33:41
> 15:33:42
> 15:33:43
> 15:33:44
> 15:33:45... etc.
>
> How do I make my plot display the actual time data and not the decimal value that matlab converts excel time data to on the graph for the x axis?

a hint:

help datetick;

us
From: TideMan on
On Jun 24, 7:21 am, ronnie <asdfess...(a)aol.com> wrote:
> When I have my original code that I posted I added datetick('x', 13);
>
> This code was supposed to work because I tested it on the same set of time data that I was reading in with the original program and a few arbitrary values to put on the Y - axis. The function displays the times in HH:MM:SS just like I want when I test the function.
>
> However, the datetick function (when used with my code) goes to produce the figure but matlab freezes and the figure is unable to be displayed.
>
> Is there anyway to get the datetick function to work around this?

I suspect your problem has nothing to do with datetick, but with what
you imagine is in b.
What do you get when you type:
[a b]
just a few lines will do.

BTW, if the code that you posted actually works, then what you are
reading into a from Excel cannot be times with format HH:MM:SS, but
decimal days. Otherwise the concatenation of a and b would not work.