Saving the data from a scatter 3D plot

I have a set of 3D points plotted in a scattered mode, is there anyway to interactively select a subset of this point cloud and save it to the workspace? (without using brush; because I can't get it to work).
The goal is to to ask the user to select a subset of the scatter plot and save the x, y, z values of the selection.
Any help is much appreciated.

댓글 수: 6

dpb
dpb 2020년 2월 29일
There's a bug report the brush doesn't work w/ scatter3 but the fix is to download R2015a so if you have more recent release it would seem should work.
Post a sample test case of what you have; we can't guess.
I am working with R2019.
I have attached a text file of a point cloud I'm working on. I would like to cut a circular subsection of this data around the center (not exactly), and automatically save the collected data to a matrix (nx3).
brush forces me to right click and save the data, but it should be automatic.
[file, path] = uigetfile({'*.csv;*.txt','(*.csv,*.txt)'});
fullFileName = fullfile(path, file);
data = readmatrix(fullFileName);
name = regexprep(file, '_', ' ');
data = data(:,(1:3));
X = data(:,1);
Y = data(:,2);
Z = data(:,3);
H = scatter3(X, Y, Z, 30, Z, '.'); colorbar, colormap('jet'); view(0, 90); axis square
brush on
Would you be able to help with this automation?
Thanks a million.
dpb
dpb 2020년 2월 29일
"The goal is to to ask the user to select a subset of the scatter plot"
And, how do you propose the use is to make this selection, otherwise?
I personally don't do much w/ GUIs so not the greatest help there, but about just asking for either a min,max x/y set of coordinates if a square region is ok or an origin and radius for circular region in the xy plane you've shown?
Then you could just test coordinates being within those bounds.
If the user needs to be able to select individual points or the like, then I'm not sure what other facilities there might be.
Feri
Feri 2020년 3월 1일
Thank you for your response.
The xy selection doesn't work ini this GUI because the user should be able to interactively select an area, get some information about it and select another area if desired. Brush does the job, exept the fact that it does not automatically save the data (that requires assigning a name to the saved the data, and makes it way difficult to use the saved data in a loop with random names).
dpb
dpb 2020년 3월 1일
Brush does the job, except ... requires assigning a name to the saved the data, and [that] makes it way difficult to use the saved data in a loop with random names)."
I've never used brush so am totally unfamiliar with its syntax/requirements, sorry.
Could you present the user with a selection tool that gives a choice of a variable name and then use it? That should let you handle the problem if so.
As said, I don't do GUIs to any extent as was fortunate to able to hand that task off to folks who really knew how to do so...hence, I'm just guessing here, sorry.
Hopefully somebody else who does know something about it will come along, too...
Feri
Feri 2020년 3월 1일
Thank you so much, I am new to GUI and it has been a nightmare so far...

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Scatter Plots에 대해 자세히 알아보기

질문:

2020년 2월 29일

댓글:

2020년 3월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by