Xticks single or double values increase

19 views (last 30 days)
Ingrid Coleen Lane
Ingrid Coleen Lane on 24 Apr 2020
Answered: Steven Lord on 24 Apr 2020
When I try to run this:
figure
H1 = gca;
plot(time,Session2audvis_audL_avg_src,'r--o')
hold on
plot(time,Session1audvis_audL_avg_src,'g')
xticks([0 .025 .05 .075 .1 .125 .15 .175 .2 .225 .25 .275 .3 .325 .35 .375 .4 .425 .45 .475 .5 .525 .55 .575 .6 .625 .65 .675 .7 .725 .75 .775 .825 .85 .875 .9 .925 .95 .975 .1])
xtickslabels(['0', '.025', '.05', '.075', '.1', '.125', '.15', '.175', '.2', '.225', '.25', '.275', '.3', '.325', '.35', '.375', '.4', '.425', '.45', '.475', '.5', '.525', '.55', '.575', '.6', '.625', '.65', '.675', '.7', '.725', '.75', '.775', '.825', '.85', '.875', '.9', '.925', '.95', '.975', '.1'])
%axis([-inf, inf, axis_min, axis_max])
title('Session audvis audL')
I recieve this error:
>> untitled5
Error using xticks (line 33)
Value must be a vector of type single or double whose values increase
Error in untitled5 (line 244)
xticks([0 .025 .05 .075 .1 .125 .15 .175 .2 .225 .25 .275 .3 .325 .35 .375 .4 .425 .45
.475 .5 .525 .55 .575 .6 .625 .65 .675 .7 .725 .75 .775 .825 .85 .875 .9 .925 .95 .975
.1])

Answers (1)

Steven Lord
Steven Lord on 24 Apr 2020
Look at the last two elements of the vector you're passing into xticks. Is the last element greater than the next-to-last element?
Rather than manually typing out each element I'd use the colon operator with a starting value, an increment, and an ending value to generate that vector.

Categories

Find more on Polar Plots in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!