Hallo guys,
I have data vs time from 15:00:00 TO 10:00:00 next day.
I'm trying to plot data vs time but the problem, it starts from 00:00 not from 15:00 and make the rest = 0
check the figure
I want to start from 15 till 00:00 and continue from 00:00 till 05:00

댓글 수: 4

Andy
Andy 2021년 3월 10일
Without seeing the data file I cannot say for certain. Is the data in a Timeseries? I assume the time is just recorded as a HH:MM:SS. You need to include the DD-MM-YYYY part then it should plot correctly.
Seth Furman
Seth Furman 2021년 3월 11일
As @Andy mentioned it is difficult for us to understand the problem without seeing data. Please attach a MAT file with the data and provide the MATLAB commands used to generate the figure above.
amr ahmed
amr ahmed 2021년 9월 2일
in the excel file, i want to plot coloumns A and B which have time and data, the problem that its 24H formate and it started from a day to next day so that the chart is cumulative.
amr ahmed
amr ahmed 2021년 9월 2일
RSSI_Average_NODE1 = readtable('Full_Room_plot.xlsx','Range','B:B'); %load column of RSSI
Array_Average_NODE1= table2array(RSSI_Average_NODE1); %convert rssi values to array
TIME_NODE1 = readtable('Full_Room_plot.xlsx','Range','J:J');%load column of RSSI
Array_Time_NODE1 = table2array(TIME_NODE1);
Time_formate_NODE1 = days(Array_Time_NODE1); %converting step
figure
plot(Time_formate_NODE1,Array_Average_NODE1) %plotting time(X-axis) Vs RSSI_Average(Y-axis)
title('NODE1')
I used this code and unfortunately the chart is not correct

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

 채택된 답변

Star Strider
Star Strider 2021년 9월 2일

0 개 추천

Try this —
Info = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/727204/Full_Room_plot.xlsx');
Info.Properties.VariableNames = compose('%c','A'+(0:9));
Array_Average_NODE1 = Info.B;
Array_Time_NODE1 = Info.J;
% Time_formate_NODE1 = hour(Array_Time_NODE1);
Time_formate_NODE1_Shift = hour(dateshift(Array_Time_NODE1, 'start','hour',-22));
figure
plot(Time_formate_NODE1_Shift, Array_Average_NODE1)
grid
xlabel('Time (hours)')
ylabel('Room Data')
The dateshift function can shift the time values to (in this instance) start at a specific time, here subtracting 22 hours from the beginning so that value is now the beginning of the series (hour 0).
Experiment to get different results.
.

댓글 수: 2

amr ahmed
amr ahmed 2021년 9월 2일
it is much better but i need the time in formate HH:MM:SS, to get the whole signal values
Try this —
Info = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/727204/Full_Room_plot.xlsx');
Info.Properties.VariableNames = compose('%c','A'+(0:9));
Array_Average_NODE1 = Info.B;
Array_Time_NODE1 = Info.J;
% Time_formate_NODE1 = hour(Array_Time_NODE1);
Time_formate_NODE1_Shift = hour(dateshift(Array_Time_NODE1, 'start','hour',-hour(Array_Time_NODE1(1))));
figure
plot(Time_formate_NODE1_Shift, Array_Average_NODE1)
grid
xlabel('Time (hours)')
ylabel('Room Data')
xtickformat('%2d:00:00')
set(gca, 'XTickLabelRotation',30)
% xt = get(gca, 'XTick'); % Without 'xtickformat'
% set(gca, 'XtickLabel',compose('%02d:00:00',xt), 'XTickLabelRotation',30) % Without 'xtickformat'
The ‘Time_formate_NODE1_Shift’ vector are no longer datetime values, so this is the best outcome.
Make appropriate changes to get different results.
.

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

추가 답변 (0개)

카테고리

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

질문:

2021년 3월 10일

댓글:

2021년 9월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by