HOW TO PLOT A LINE GRAPH AND TABLE FOR THE DATA BELOW

1 Ansicht (letzte 30 Tage)
hassan USMAN
hassan USMAN am 22 Jun. 2016
Kommentiert: dpb am 22 Jun. 2016
TABLE :5 Monthly Eb/No Level At Selected Radio Nigeria Fm Stations across Nigeria
MONTH COAL SUPREME METRO PREMIER
(A) (B) (C) (D)
JUL 2015 5.4 5 5.5 5
AUG 2015 6.4 6 6.8 6.4
SEP 2015 7.7 8 6.3 7.7
OCT 2015 4.6 5.6 6.3 4.6
NOV 2015 8.5 9.5 5.6 8.5
DEC 2015 5 12 5 5
JAN 2016 4 12 6.1 4
FEB 2016 6 11 6.3 6
MAR 2016 8.5 8 8.7 8.5
APR 2016 9.4 9 9.5 9.4
MAY 2016 4 7 8 6
DEC 2016 5 8 9 4
TO PLOT A LINE GRAPH OF MONTH ON X-AXIS AGAINST AND A,B,C, AND D ON Y-AXIS
  2 Kommentare
Muhammad Usman Saleem
Muhammad Usman Saleem am 22 Jun. 2016
please edit your question, or attached as text or excel file your table? difficult to read
dpb
dpb am 22 Jun. 2016
Have you read the examples at <create-a-table>? It shows building a histogram from table data; nothing much different than using plot instead.
Show us what you've tried and where you ran into problems...
doc plot

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Valentino
Valentino am 22 Jun. 2016
Bearbeitet: Valentino am 22 Jun. 2016
i guess you have the data in a txt file so you will have to use textscan and then plot
input = textscan(fileID,'%s%f%f%f%f','HeaderLines',1,'Delimiter', ' ');
  1 Kommentar
dpb
dpb am 22 Jun. 2016
Ah...perhaps you're right; I interpreted that the OP already had a table (Matlab style)...
Your textscan isn't likely going to work, however, if the file is as shown. Try
fmt=['%{MMM yyyy}D' repmat('%f',1,4)]; % one datetime, four floats
c=textscan(fid,fmt,'headerlines',5,'collectoutput',1);
'headerlines' is either 3 or 5, depending on whether the file includes the title lines or not...this will leave OP with a datetime cell array and then a cell array of doubles for the data.
If OP were to clean up the file to have just the column headers and the data, should be able to use readtable and get an internal table directly.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Line Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by