Hi all,
I just want to plot these data in matlab, however, I got confused about plotting
Time 1/1/2020 2/1/2020
00 - 01 46.88 36.24
01 - 02 51 32.74
02 - 03 48.26 31.22
03 - 04 35.18 28.12
04 - 05 31.8 27.68
05 - 06 30.94 27.89
06 - 07 30.88 33.13
07 - 08 30.8 41.1
08 - 09 31.6 43.54
09 - 10 32.82 44.08
10 - 11 38.26 44.51
11 - 12 44.6 46.16
12 - 13 52.26 46.22
13 - 14 46.94 45.96
14 - 15 46.94 45.1
15 - 16 46.58 44.98
16 - 17 43.42 45.42
17 - 18 58.91 47.47
18 - 19 62.55 54.16
19 - 20 50.46 47.2
20 - 21 48.28 44.73
21 - 22 42.25 37.76
22 - 23 42.16 33.8
23 - 00 37.56 32.62
Where, x axes will be from 0-24 and y-axes should be the values. so, how can I settle it in matlab where the plot must same be as attached image

 Réponse acceptée

KSSV
KSSV le 28 Juil 2021
Modifié(e) : KSSV le 28 Juil 2021

0 votes

T = readtable(filename) ; % your file where data is present
x = (1:24)' ;
plot(x,T.(2),'r',x,T.(3),'b')

5 commentaires

Ali Najem
Ali Najem le 28 Juil 2021
Thanks alot for your answer KSSV,
'X' is unrecognized !?
KSSV
KSSV le 28 Juil 2021
Type error..it should x. Edited the naswer.
Ali Najem
Ali Najem le 28 Juil 2021
Also, it didn't work
Vectors must be the same length.
KSSV
KSSV le 28 Juil 2021
Modifié(e) : KSSV le 28 Juil 2021
T = readtable(filename) ; % your file where data is present
plot(T.(2),'r')
hold on
plot(T.(3),'b')
Ali Najem
Ali Najem le 28 Juil 2021
it worked, but unfortunately not as expected graph

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by