In plotting a string vector I got as result that matlab make it in alphabetical order, how can I solve this?
I have to plot this:
x=januar
februar
marts
april
maj
juni
juli
august
september
oktober
november
december
Y=0.363112625
0.401244846
0.557567924
0.3938561
0.237848854
0.21611666
0.225111254
0.245804562
0.481396094
0.611200928
0.911855992
1.197021623

 채택된 답변

Dyuman Joshi
Dyuman Joshi 2021년 5월 21일

1 개 추천

plot(Y);
xticks(1:12);
xticklabels({'januar','februar', 'marts', 'april', 'maj', 'juni', 'juli', 'august', 'september', 'oktober', 'november', 'december'})

댓글 수: 7

Chiara Scarpellini
Chiara Scarpellini 2021년 5월 21일
but the x don't match with their ordinates
Dyuman Joshi
Dyuman Joshi 2021년 5월 21일
You want jan for the smallest value, feb for the 2nd smallest, like this?
Chiara Scarpellini
Chiara Scarpellini 2021년 5월 21일
yes
Dyuman Joshi
Dyuman Joshi 2021년 5월 21일
plot(sort(Y));
xticks(1:12);
xticklabels({'januar','februar', 'marts', 'april', 'maj', 'juni', 'juli', 'august', 'september', 'oktober', 'november', 'december'})
Dyuman Joshi
Dyuman Joshi 2021년 5월 22일
If you find my answer helpful, kindly accept it.
Chiara Scarpellini
Chiara Scarpellini 2021년 5월 24일
I got this
Dyuman Joshi
Dyuman Joshi 2021년 5월 26일
I ran the code on my pc an I got this

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Characters and Strings에 대해 자세히 알아보기

질문:

2021년 5월 21일

댓글:

2021년 5월 26일

Community Treasure Hunt

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

Start Hunting!

Translated by