pcshow permanently changes figure window?

5 次查看(过去 30 天)
John
John 2022-11-25
编辑: John 2022-11-28
This is a minor issue but I'm not sure it's intended behaviour. When using pcshow to display a pointcloud, the figure window switches to a pointcloud viewer appearance (black background) and this change is persistent through clearing the figure (i.e., with clf).
Simple example:
load('object3d.mat')
figure(1);
pcshow(ptCloud);
clf; %This should leave us with a blank figure.
A = [0 0 0;0 1 0;0 0 1];
plot3(A(:,1),A(:,2),A(:,3),'.'); %plot something
This behaviour seems inconsistent with most other use cases in which clf completely resets the figure to default.

回答(2 个)

Ishan
Ishan 2022-11-28
编辑:Ishan 2022-11-28
clfdeletes all children of the current figure that have visible handles.
load('object3d.mat')
figure(1);
pcshow(ptCloud);
clf; %This should leave us with a blank figure.
A = [0 0 0;0 1 0;0 0 1];
plot3(A(:,1),A(:,2),A(:,3),'.'); %plot something
So, in your case also the axes get cleared after clf is called (resulting in a black screen) and values get reset to default. When you plot on the same figure it gets plotted over the same initial set of axes you used earlier, hence the behavior seems to be consistent.
For more information, please refer to: -
Also, the recommended function to use for removing app data is actually ‘rmappdata’. ‘clf’ us mainly used to clear the figure window. The syntax for ‘rmappdata’ is as follows:
rmappdata(h,name) % removes the application-defined data, name, from its association with the UI component, h.
  1 个评论
John
John 2022-11-28
编辑:John 2022-11-28
Thanks for your reply and to (Pravarthana) as well. But I still think there's a disconnect between what's happening and what users expect to happen.
I'll accept that as stated in the documentation:
clf (without any modifiers), deletes all children of the current figure that have visible handles
However, there is the extra
clf reset (different syntax) deletes all children of the specified figure and resets its properties.
Interstingly, applied to my previous example, this now gives an error.
load('object3d.mat')
figure(1);
pcshow(ptCloud);
clf reset;
Warning: Error occurred while executing the listener callback for event ObjectBeingDestroyed defined for class matlab.graphics.chart.primitive.Scatter:
Dot indexing is not supported for variables of this type.

Error in pointclouds.internal.pcui.initializePCSceneControl>cleanupPCSceneControl (line 1250)
delete(hui.UIContextMenu);

Error in clo (line 53)
obj.clo(hsave, (do_reset == 1)); % Call clo method on graphics class

Error in clf (line 117)
clo(fig, extra{:});

Error in LiveEditorEvaluationHelperEeditorId (line 4)
clf reset;

Error in connector.internal.fevalMatlab

Error in connector.internal.fevalJSON
I would maintain that based on customary understanding of the intended usage of this function, that this should not give an error.

请先登录,再进行评论。


Pravarthana P
Pravarthana P 2022-11-28
Hi John Enright,
The functionality of ‘clf’ command is to clear the contents of the figure window.
For more information the following documentation link can be referred.
To clear the point cloud viewer from the associated UI component using "rmappdata"may be helpful.
‘rmappdata’ will remove the application data, identified by name, from its association with the UI component obj.
The following documentation links may be used for further information:
Hope this information helps you!

类别

Help CenterFile Exchange 中查找有关 Point Cloud Processing 的更多信息

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by