data = num2ruler(num,ruler) converts
the numeric values in num to the appropriate values
for the specified ruler. The resulting values depend on both the type
and limits of the ruler input. The output data is
an array the same size as num.
Convert the output of ginput from
a numeric value to the equivalent date value.
Create a plot with dates along the x-axis.
Then, click a point in the axes and use the ginput function
to return the location of the selected point.
t = datetime(2015,1,1:10);
y = rand(10,1);
plot(t,y)
ax = gca;
[x,y] = ginput(1)
x =
5.8168
y =
0.6458
The ginput function returns the location as numeric values. Use
num2ruler to determine the date value that is
equivalent to the numeric value returned for
x.
Ruler that determines data mapping, specified as one of these
types of ruler objects:
DurationRuler object — Convert the
values in num to duration values.
DatetimeRuler object — Convert the
values in num to datetime values. To control
how numeric values are converted to datetime
values, set the ReferenceDate property of the ruler to a
datetime value with the desired time zone.
NumericRuler object — No conversion.
The output is equal to the input.
CategoricalRuler object — Convert
the values in num to categorical values. To
control the order of the categories, set the Categories property of the ruler.
GeographicRuler object — No
conversion. The output is equal to the input.
Specify the ruler object as the XAxis, YAxis, or
ZAxis property of the Axes object.
For example:
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window.
Web browsers do not support MATLAB commands.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.