MATLAB: How do i keep the format of xticklabels

xticks

xticks(0:6)
xticklabels(10.^(xticks))
10.^(xticks)
xticklabels
10.^(xticks) returns:
ans =
1 10 100 1000 10000 100000 1000000
but from xticklabels i get:
ans =
7×1 cell array
{'1' }
{'10' }
{'100' }
{'1000' }
{'10000' }
{'100000'}
{'1e+06' }
how do i keep the format so that it keeps the last label as '1000000' and not be converted to '1e+06'.
this is part of a bigger script, wich tests for max an min values of the plots. so manually writing all the labels is not really an optin.

Best Answer

Use compose or sprintfc to create the cell array of labels:
figure
plot(0:6, rand(1,7))
xtl = sprintfc('%d',10.^(0:6));
xtl = compose('%d',10.^(0:6));
Ax = gca;
Ax.XTickLabel = xtl;
The ‘xtl’ variable is the same for both, so choose one. (The sprintfc function is undocumented, however everyone has it. Not everyone may have the compose function.)
EDIT — (31 Mar 2020 at 18:00)
Try this:
F = openfig('test.fig');
Kids = F.Children;
Ax = findobj(Kids, 'Type','Axes');
Ax(2).XTickLabel = sprintfc('%d',10.^(0:6));