Xticks single or double values increase

조회 수: 19 (최근 30일)
Ingrid Coleen Lane
Ingrid Coleen Lane 2020년 4월 24일
답변: Steven Lord 2020년 4월 24일
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])

답변 (1개)

Steven Lord
Steven Lord 2020년 4월 24일
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.

카테고리

Help CenterFile Exchange에서 Polar Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by