How do I select a region on a 3D plot and extract the indices of the enclosed points?
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have a series of x, y, and z data (let's call them x_data, y_data, z_data). I make a 3D plot using imagsc.
Now I want to make the resulting figure interactive such that I can select regions of this plot with my mouse and produce a 2D cut from my 3D image.
Right now I have a separate code, shown below, that does this. For examlple, to get a y-z cut at a certain value of x: I choose an x value, get an appropriate number of indices ("width") around that, get the corresponding z values, average them, and plot them against the corresponsing y values.
x = 600;
width = 50;
x_cut = find(x+width/2>x_data & x-width/2<x_data);
z_cut = z_data(:,x_cut(1):x_cut(end));
z_cut_mean = mean(z_cut, 2);
figure; plot(y_data, z_cut_mean)
But I want to make this process an interactive one right on the 3D graph itself. I was thinking that if I could get the indices out with a selection tool somehow, I'd be able to use the code above from line 4 perhaps. Or somethig like that.
What is the best way to go baout doing somethig like this? Should I be looking itno making GUI's or is there a simpler way of extracting the indices I need from the graph?
Thanks!
0 commentaires
Réponses (1)
Voir également
Catégories
En savoir plus sur Bar Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!