Conversion operators error!

조회 수: 7 (최근 30일)
Lukas Netzer
Lukas Netzer 2021년 5월 6일
댓글: Image Analyst 2021년 5월 6일
I'm trying to set my xTicklabels:
set(gca, 'xtick',1:8,'XTickLabels',compose('diffNA2l','diffNA2h','diffA2l','diffA2h','allNA2h','allNA2l','allA2l','allA2h'))
it is giving me
Error using compose (line 98)
Format must have enough conversion operators for the data arguments.
Why?

채택된 답변

Scott MacKenzie
Scott MacKenzie 2021년 5월 6일
You don't need compose because you aren't formatting numeric values into the labels. Just specifiy your labels in a cell array:
bar(1:8, rand(1,8));
labels = {'diffNA2l','diffNA2h','diffA2l','diffA2h','allNA2h','allNA2l','allA2l','allA2h'};
set(gca, 'xtick', 1:8, 'XTickLabels', labels);
  댓글 수: 2
Lukas Netzer
Lukas Netzer 2021년 5월 6일
thanks a lot - still much to learn!
Image Analyst
Image Analyst 2021년 5월 6일
Or you could use the separate functions made for dealing with tick marks (R2016b and later):
xticks()
xticklabels()

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Grid Lines, Tick Values, and Labels에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by