App desiner GUI crashes when use scatter3
9 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi,
i have a problem with app designer and scatter3.
When I use scatter3 specifying the color for each point, the app crashes without giving any errors.
This is the line that causes the app to unexpectedly close:
scatter3 (app.UIAxes_GL_3D, ROI_coord(:, 1), ROI_coord(: 2), ROI_coord(:, 3), 1, color_matrix);
ROI_coord is a matrix of 22375x3 double, color_matrix is a matrix of 22375x3 double (with values between 0 and 1), UIAxes_GL_3D is the app axis.
I tried to use fewer points and in that case everything works fine.
I use Matlab version 2020a.
Why does this happen?
Thank you,
Davide
0 Commenti
Risposte (2)
Adam Danz
il 10 Feb 2021
Modificato: Adam Danz
il 11 Feb 2021
I've reproduced the problem using Matlab Online with the code below (commented-out to discourage people from trying it). Matlab Online crashes and throws an error in Chrome: Error code: Out of Memory
But this shouldn't cause Matlab to crash. It should just throw an error. I encourage you to report the problem: Contact Us - MATLAB & Simulink
% This will crash Matlab (Matlab Online 2020b)
% ROI_coord = rand(22375,3);
% color_matrix = rand(22375,3);
%
% app.UIAxes_GL_3D = uiaxes();
% scatter3 (app.UIAxes_GL_3D, ROI_coord(:, 1), ROI_coord(:, 2), ROI_coord(:, 3), 1, color_matrix);
There may be other ways to plot your data that don't involve storing 22375 graphics objects. Without knowing more about the intended visualization, it's tough to make suggestions.
Update I
Without the color_matrix, the scatter plot is created without a problem.
Update II
I traced the problem in scatter3() and it crashes when the CData property is set (the color matrix). Even if you set the CData after the plot is generated, it will still crash (see below).
ROI_coord = rand(22375,3);
color_matrix = rand(22375,3);
app.UIAxes_GL_3D = uiaxes();
h = scatter3 (app.UIAxes_GL_3D, ROI_coord(:, 1), ROI_coord(:, 2), ROI_coord(:, 3), 1);
% crash here:
% h.CData = color_matrix;
Update III
None of these problems happen with Matlab r2020b (update 4) on Microsoft Windows 10.
Workaround ideas
If there is color grouping, use indexing to plot each group separately using plot3() or scatter3(). dr
You could try using color indexing rather than defining the RGB value matrix. That's covered the documentation.
If each point varies in color, you might be able to visualize the data using another form such as a controur or surface. Perhaps you could reduce the density of data and plot custers using kmeans or another clustering method.
16 Commenti
Veronica Taurino
il 25 Feb 2021
Modificato: Veronica Taurino
il 25 Feb 2021
Hi Davide, I already read your answer, thank you. My intention by replying was to point out that one more person is hoping to fix it . I don't know how it works on Mathworks community, I thought the more feedback they have, the sooner they decide to work on it (more people asking = feature greatly required = priority for the team).
[I am working on point cloud on GUI, both pcshow and scatter3 have trouble, I am going to try plot3 but I already know I will have other issue (due to my specific workflow I mean). Thank you, bye]
Vedere anche
Categorie
Scopri di più su Environment and Settings in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!