How to get xticklabels from xticks by merging cells?
Show older comments
Dear all,
I want to get my ticklabels from an array of numbers.
As the function
is taking a cell-array, I want to create a function
which enables the conversion of my array of numbers
into a cell
:
Xticks = [1,2,3];
Xtickslabels = tick2ticklabel(Xticks)
>>> Xtickslabels = {'1','2','3'}
I tried this:
Xticks = [1,2,3];
tmp = split(num2str(Xticks))
tmp = reshape(tmp,1,length(tmp))
But I am stuck here as I didn't find a way to merge the cells into one.
Thanks in advance.
Best regards,
louis
Accepted Answer
More Answers (2)
Mathieu NOE
on 24 Aug 2022
hello
here you are my friend :
Xticks = [1,2,3];
tmp = num2str(Xticks);
Xtickslabels{1} = tmp;
Louis Tomczyk
on 24 Aug 2022
2 Comments
Mathieu NOE
on 24 Aug 2022
hello again
Xticklabels must not be a 1 x 1 cell but a 1 x 20 cell
making all this code for 1 x 1 cell is unneccessary
Louis Tomczyk
on 24 Aug 2022
Categories
Find more on Axis Labels in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!