HOW TO PLOT A LINE GRAPH AND TABLE FOR THE DATA BELOW
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
Muhammad Usman Saleem
2016-6-22
please edit your question, or attached as text or excel file your table? difficult to read
dpb
2016-6-22
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
采纳的回答
Valentino
2016-6-22
编辑:Valentino
2016-6-22
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 个评论
dpb
2016-6-22
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.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Discrete Data Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!