setappdata, where to verify?

I'm slowly progressing on my way to Matlab "nirvana"...
How would I go about checking whether an element has indeed been added to a figure object? Suppose I use this code in my script :
set(FigureH, 'Position', [1800 500 f_Largeur f_Hauteur]);
ax1 = gca;
setappdata(FigureH,'axImage', ax1);
breakpoint = 1;
Suppose I set a breakpoint right after setappdata and navigate to the Command Window and type :
>> Get(FigureH)
... to get all FigureH properties, I don't see the appdata I just created, that are supposed to be stored in the figure, according to the documentation? I was expecting, possibly, to see it in UserData[ ]?

 采纳的回答

Use
getappdata(FigureH)
to view/verify the application data associated with FigureH via setappdata().

2 个评论

IOW, the appdata is not stored in the figure properties per se?
It is there, in a property called 'ApplicationData', which doesn't show up by default when you do get(FigureH).
f = figure();
setappdata(f,'test_app_data',1);
get(f) % no ApplicationData property listed
Alphamap: [0 0.0159 0.0317 0.0476 0.0635 0.0794 0.0952 0.1111 0.1270 0.1429 0.1587 0.1746 0.1905 0.2063 0.2222 0.2381 0.2540 0.2698 0.2857 0.3016 0.3175 0.3333 0.3492 0.3651 0.3810 0.3968 0.4127 0.4286 … ] BeingDeleted: off BusyAction: 'queue' ButtonDownFcn: '' Children: [0×0 GraphicsPlaceholder] Clipping: on CloseRequestFcn: 'closereq' Color: [1 1 1] Colormap: [256×3 double] ContextMenu: [0×0 GraphicsPlaceholder] CreateFcn: '' CurrentAxes: [0×0 GraphicsPlaceholder] CurrentCharacter: '' CurrentObject: [0×0 GraphicsPlaceholder] CurrentPoint: [0 0] DeleteFcn: '' DockControls: on FileName: '' GraphicsSmoothing: on HandleVisibility: 'on' Icon: '' InnerPosition: [671 661 577 433] IntegerHandle: on Interruptible: on InvertHardcopy: on KeyPressFcn: '' KeyReleaseFcn: '' MenuBar: 'none' Name: '' NextPlot: 'add' Number: 1 NumberTitle: on OuterPosition: [671 657 577 458] PaperOrientation: 'portrait' PaperPosition: [1.3359 3.3131 5.8283 4.3737] PaperPositionMode: 'auto' PaperSize: [8.5000 11] PaperType: 'usletter' PaperUnits: 'inches' Parent: [1×1 Root] Pointer: 'arrow' PointerShapeCData: [16×16 double] PointerShapeHotSpot: [1 1] Position: [671 661 577 433] Renderer: 'opengl' RendererMode: 'auto' Resize: on Scrollable: off SelectionType: 'normal' SizeChangedFcn: '' Tag: '' ToolBar: 'none' Type: 'figure' Units: 'pixels' UserData: [] Visible: off WindowButtonDownFcn: '' WindowButtonMotionFcn: '' WindowButtonUpFcn: '' WindowKeyPressFcn: '' WindowKeyReleaseFcn: '' WindowScrollWheelFcn: '' WindowState: 'normal' WindowStyle: 'normal' XDisplay: ':1.0'
get(f,'ApplicationData') % but here it is, including 'test_app_data'
ans = struct with fields:
IsDebugFigureDirty: 1 test_app_data: 1

请先登录,再进行评论。

更多回答(0 个)

类别

在 帮助中心 和 File Exchange 中查找有关 Interactive Control and Callbacks 的更多信息

产品

版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by