HOW TO PLOT A LINE GRAPH AND TABLE FOR THE DATA BELOW
조회 수: 4 (최근 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에서 Line Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!