Image 通过更新功能在MatlabGUI上绘制图像和点

Image 通过更新功能在MatlabGUI上绘制图像和点,image,matlab,user-interface,graph,plot,Image,Matlab,User Interface,Graph,Plot,请原谅,这是我的第一篇文章 我在matlab中生成了这个gui,我想从更新函数在一个轴上绘制一个图像 我知道在Matlab中,你可以像 图像(img) 等等 图(x1,z1) 拖延 但是如何使用gui实现这一点呢 这里是更新功能的一部分 %get a handle to the GUI's 'current state' window deflectionx = findobj('Tag','deflectionx_display'); deflectiony = findobj('Tag','

请原谅,这是我的第一篇文章

我在matlab中生成了这个gui,我想从更新函数在一个轴上绘制一个图像

我知道在Matlab中,你可以像

图像(img) 等等 图(x1,z1) 拖延

但是如何使用gui实现这一点呢

这里是更新功能的一部分

%get a handle to the GUI's 'current state' window
deflectionx = findobj('Tag','deflectionx_display');
deflectiony = findobj('Tag','deflectiony_display');
depth = findobj('Tag','depth_display');
Graph = findobj('Tag','Graphical_display');
UltraS = findobj('Tag','UltraS_image');
%update the gui
set(deflectionx,'String',x_def);
set(deflectiony,'String',y_def);
set(depth,'String',insert_depth);


%% above works fine. below does not

%i want this to plot those points on top of the image in the large graph panel of the gui
plot(Graph,img1)
hold on
plot(Graph,x1,z1);
hold off

%this should plot the second image on the UltraS panel
plot(UltraS,img2)

请提前感谢

所以我想我必须在GUI的打开功能中将GUI的句柄写入工作区

% --- Executes just before VR_gui is made visible.
function VR_gui_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to VR_gui (see VARARGIN)

% Choose default command line output for VR_gui
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

%setting axis
needle_plot = handles.Graphical_display;
US_plot = handles.US_image;

%write handle to workspace
assignin ('base','needle_plot',needle_plot);
assignin ('base','US_plot',US_plot);
然后从更新函数中读取工作空间变量

needle_plot = evalin('base','needle_plot');
US_plot = evalin('base','US_plot');

axes(US_plot);
image(img2);

axes(needle_plot);
plot(x1,z1,'r--o');

为什么它不起作用??没有显示任何内容?显示的内容不正确?底部部分不起作用,顶部部分提取从函数接收的数据,并使用标记“偏转X”、“偏转Y”、“深度”更新gui。我认为这是因为我只是更改字符串的值。图形和UltraS变量指的是我gui的两个绘图。没有显示任何内容。