Why is there no DataIndex field in cursor_info for scatter plots?

A
arundsouza · Aug 17, 2020 · 1.9K views
Question
Export cursor data to the workspace using the following steps: 1. Generate a scatter plot using the following code:   [x, y] = meshgrid (0: 0.1: 1.0: .1: 1); scatter(x(:), y(:),10) 2. Add a few data cursors on the figure. 3. Right-click on the figure and select the ‘Export Cursor Data to Workspace’ option. The "cursor_info" structure appears in the workspace. This structure has sub-structures corresponding to each data cursor on the plot. I see that each of these sub-structures has two fields: ‘Target’ and ‘Position’. However, for a plot generated using the PLOT function (e.g., x1 = [1 2 3]; y1 = [4 5 6]; plot(x1,y1);), I find that the corresponding data cursor structures have three fields: ‘Target’, ‘Position’ and ‘DataIndex’. Note the additional 'DataIndex' field for data cursors in the latter case. Why is there no such 'DataIndex' field in cursor_info for scatter plots?
Expert Answer
Profile picture of John Williams
John Williams PhD Expert
Answered Aug 23, 2026
The 'DataIndex' field is created in the "cursor_info" structure only when data cursors are added to line objects.
This field does not exist for images, surfaces, or any other object.
100% Run Guarantee 3-Hour Fast-Track Delivery

Need a Custom Version or Complete Simulation for This Problem?

Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.

Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!