Collect multiple data cursor mode info as a matrix from a 3d scatter plot (xyz coordiantes).

2 views (last 30 days)
My aim is to collect multiple data cursor mode info as a matrix from a 3d scatter plot (xyz coordiantes). Each row should correspond to a datatip position and give the x,y,z location. I also calculate the normal deviation from centre for these values.
I am using getCursorInfo to collect position data about a 3d scatter plot.
dcm_obj = datacursormode(f2);
set(dcm_obj,'DisplayStyle','datatip',...
'SnapToDataVertex','off','Enable','on');
When ran, the position info is saved as a 3 wide row vector (x,y,z) dcm_obj_info = getCursorInfo(dcm_obj); dcm_obj_pos = dcm_obj_info.Position;
I then calculate the normal deviation from centre of this data and add it as the 4th column to the data.
dcm_obj_normd = sqrt(sum(dcm_obj_pos.^2,2) );
dcm_obj_data = [dcm_obj_pos dcm_obj_normd];
What i need to do now is create a matrix with each row containing the row vector dcm_obj_data, however the values will when a new cursor location is selected and the code ran again. Instead of overwriting the row vector from previous location I want it to be inserted as a new row in the matrix.
I believe I should be using some kind of loop solution.

Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by