plot time versus temperature

조회 수: 10 (최근 30일)
Kaushal Mishra
Kaushal Mishra 2013년 9월 6일
I have excel file with time and temperature listing.
time temp
13:51:42 30
13:51:44 31
13:51:46 32
13:51:48 34
seconds in the gap of 2 seconds till 58 and temperature in gap of 1. i have to plot the graph of time and temp in matlab. Time on the x axis and Temp on y axis. i read the temp and time by xlsread.
filename= 'temp1.xlsx';
temp=xlsread(filename, 'B:B');
time=xlsread(filename,'A:A');
timestr= datestr(time,'HH:MM:SS');
i tried to read the time in HH:MM:SS format. i got output of timestr as val= 13:51:42 , 13:51:44 ans=d so on uptill 13:51:58.It's written in the output as scalar value . The result is not the matrix . I am unable to plot this scalar quantity with the matrix of temp. Now,how to plot these values. "plot" function alone is not working. pls pls help
  댓글 수: 2
Azzi Abdelmalek
Azzi Abdelmalek 2013년 9월 6일
Post a sample of the data you want to plot
Image Analyst
Image Analyst 2013년 9월 6일
You forgot to show your plot line, and explain what's not working (error message, or just not what you expect). Post a screenshot to httpL//snag.gy

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

답변 (1개)

Walter Roberson
Walter Roberson 2013년 9월 6일
plot(timestr, temp);
datetick('x', 'HH:MM:SS')
  댓글 수: 2
Kaushal Mishra
Kaushal Mishra 2013년 9월 7일
I tried this earlier but it is not working. Because the timestr result is not a matrix. It shows as "val= 13:51:42 , 13:51:44 uptill 13:51:58".
Walter Roberson
Walter Roberson 2013년 9월 7일
In the excel file, what format is the time in? Please give a couple of lines of sample input.

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

카테고리

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