How to fit num2str into labeling ??
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Isa Duran
am 22 Mai 2014
Kommentiert: Star Strider
am 22 Mai 2014
Hi Guys
I have trouble with using num2str for labeling x-axis. I'm doing this for get each number of SR on equivalent x-axis. Can anybody tell me what I'm doing wrong ? Now I get the same number of SR in all x-axis.
SR=[23 15 16 17 11] for i=1:length(SR) set(gca, 'XTick',1:length(SR), 'XTickLabel',{num2str(SR(i))}) end
Isa
0 Kommentare
Akzeptierte Antwort
Star Strider
am 22 Mai 2014
Use a cell array:
figure(1)
plot(1:5, (1:5).^2)
grid
SR=[23 15 16 17 11]
SRC = {SR};
set(gca, 'XTick',1:length(SR), 'XTickLabel',SRC)
You can eliminate the loop.
1 Kommentar
Weitere Antworten (2)
Siehe auch
Kategorien
Mehr zu Axis Labels 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!