2
我知道这个错误是在popupmenu初始化一个空列表时引起的,但是我有几个popupmenu,如何知道弹出菜单的标签会产生这个错误? 或者有办法停止生成此警告?Matlab - 警告:popupmenu控件需要一个非空字符串
感谢
我知道这个错误是在popupmenu初始化一个空列表时引起的,但是我有几个popupmenu,如何知道弹出菜单的标签会产生这个错误? 或者有办法停止生成此警告?Matlab - 警告:popupmenu控件需要一个非空字符串
感谢
如果您使用的是结构化的阵列,如handles
与使用MATLAB指南或您自己的结构数组的,这可以通过寻找组件的双重价值处理和匹配的字段名的工作该结构通过在脚本或命令行中调用您的结构(取决于工作空间)。
components = findall(figure_handle,'Style','Popupmenu'); % returns double value for each handle
menu_strings = get(components,'String'); % gets the string of each popupmenu
indx = find(strcmpi(menu_strings,'')); % returns the position in the array of the empty components
wanted_components = components(indx) % returns the double value of the components that have an empty string
此外,您还可以使用Tag
财产,如果你在标签设置,你可以再添加:
get(wanted_components,'Tag')
查看文档find all和tag property。
这是一个警告,不是错误,对吧?看看[如何抑制警告](http://www.mathworks.de/de/help/matlab/matlab_prog/suppress-warnings.html) – thewaywewalk