Conversion operators error!

6 次查看(过去 30 天)
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