
how can i draw a 2 columns (as a time first raw is from 0 to 20 this in x axis and in y axis is from the 3rd column) and the 3rd is category
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Manar Gbaily
am 17 Jun. 2020
Bearbeitet: Manar Gbaily
am 18 Jun. 2020
, *note*(y axis is only three values(sil,Tr, NTr) and are repeated randomly)
as follow data:
0 Kommentare
Akzeptierte Antwort
KSSV
am 17 Jun. 2020
Bearbeitet: KSSV
am 17 Jun. 2020
% Read the file
file = "ex3data.txt" ;
fid = fopen(file,'r') ;
S = textscan(fid,'%f %f %s') ;
fclose(fid) ;
% Seperate each data
S1 = S{:,1} ;
S2 = S{:,2} ;
S3 = S{:,3} ;
str = unique(S3) ;
C = {'r', 'g','b'} ;
for i = 1:length(str)
idx = strcmp(S3,str{i}) ;
bar(idx*i,'facecolor',C{i})
hold on
end
legend(str)

You can explore the other plotting options.
2 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Graphics Performance 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!