datacursormode — Control data cursor interaction mode for figures.
datacursormode toggles or configures MATLAB-compatible data cursor mode state. It returns a live data cursor manager object whose common properties can be read or updated through get and set.
Syntax
dcm = datacursormode()
datacursormode()
status = datacursormode(option)
dcm = datacursormode(fig)
status = datacursormode(fig, option)Inputs
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
option | StringScalar | Yes | — | Mode option: on, off, or toggle. |
fig | NumericScalar | Yes | — | Target figure handle. |
Returns
| Name | Type | Description |
|---|---|---|
dcm | Any | Data cursor mode object for the current or specified figure. |
status | StringScalar | Returns "ok" when the command succeeds. |
Errors
| Identifier | When | Message |
|---|---|---|
RunMat:datacursormode:InvalidArgument | Argument count, figure handle, option, or property is invalid. | datacursormode: invalid argument |
RunMat:datacursormode:Internal | Internal data cursor state or handle-object update fails. | datacursormode: internal operation failed |
GPU memory and residency
datacursormode mutates plotting interaction metadata only. It does not gather or copy GPU-resident plot data.
Examples
Enable data cursor mode
plot(1:10);
datacursormode on;Expected output:
% Data cursor mode is enabledUse the data cursor manager object
dcm = datacursormode;
set(dcm, 'DisplayStyle', 'window', 'SnapToDataVertex', 'off');
get(dcm, 'DisplayStyle')Expected output:
ans = 'window'Using datacursormode with coding agents
Open a RunMat example with live inputs, then ask the agent to explain how datacursormode changes the result.
Run a small datacursormode example, explain the result, then change one input and compare the output.
Related Plotting functions
2D Charts
area · bar · errorbar · heatmap · hist · histogram · loglog · pie · plot · scatter · semilogx · semilogy · stairs · stem
Other
addpoints · ancestor · animatedline · axes · barh · cla · clf · colorcube · colororder · copyobj · daspect · dataTipTextRow · fcontour · figure · fill3 · findobj · fsurf · gobjects · groot · hgload · hgsave · hidden · histogram2 · hold · line · linkaxes · openfig · opengl · pan · parula · patch · plotmatrix · plotyy · polarhistogram · polarplot · polarscatter · print · quiver3 · ribbon · saveas · savefig · sphere · stackedplot · subtitle · suptitle · textscatter · textscatter3 · triplot · waitbar · wordcloud · xline · xscale · xtickangle · xtickformat · xticklabels · xticks · yline · yscale · ytickangle · ytickformat · yticklabels · yticks · zoom
About RunMat
RunMat is an open-source runtime that executes MATLAB-syntax code blazing on any GPU. It is licensed under the Apache 2.0 license.
- RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed. Simulations that took hours now take minutes.
- Start running code in seconds. RunMat runs in the browser, on the desktop, or from the CLI. No license server, no IT ticket.