我想打开一个图像,然后在MATLAB中启用一个按钮。如何?
我有以下MatlabGUI代码我想打开一个图像,然后在MATLAB中启用一个按钮。如何?,matlab,Matlab,我有以下MatlabGUI代码 clear all; clc; win = figure('units','points',... 'position',[200 250 500 400],... 'color',[.8 .8 .8],... 'menubar','none',... 'resize','off',... 'numbertitle','off',... 'name','test window'); menu = uimenu('
clear all;
clc;
win = figure('units','points',...
'position',[200 250 500 400],...
'color',[.8 .8 .8],...
'menubar','none',...
'resize','off',...
'numbertitle','off',...
'name','test window');
menu = uimenu('parent',win,...
'Label','File');
submenu1 = uimenu('parent',menu,...
'Label','Open');
submenu2 = uimenu('parent',menu,...
'Label','Exit',...
'Callback','close');
frame1 = uicontrol('parent',win,...
'units','points',...
'position',[30 170 200 200],...
'backgroundcolor',[.9 .9 .9],...
'style','Frame');
recButton = uicontrol('parent',win,...
'units','points',...
'position',[90 130 70 30],...
'style','pushbutton',...
'string','Button');
我要做的是加载一个带有打开子菜单(子菜单1)的图像,然后在frame1中显示它。默认情况下,“我想要录制”按钮处于禁用状态。加载映像后,recButton将启用。您能帮我处理代码吗?您应该首先创建
recButton
控件,并将其设置为'off'
。然后在为子菜单1执行的中,您应该重新启用recButton
控件:
set(recButton,'Enable','on');
您只需确保句柄变量recButton
在子菜单1
的回调中可用,默认情况下禁用了I want recButton。应该是我希望默认情况下禁用recButton。我不是以英语为母语的人,所以英语不流利。谢谢你的更正。