简体   繁体   English

如何在MATLAB的应用程序设计器中使用'waitfor'或'uiwait'?

[英]How use 'waitfor' or 'uiwait' in app designer of MATLAB?

How use waitfor or uiwait in app designer of MATLAB? 如何在MATLAB的应用程序设计器中使用waitforuiwait These funtions only work with figures (GUIDE) not app designer windows. 这些功能仅适用于数字(GUIDE)而非应用程序设计器窗口。 How can I have same behavior in app designer? 如何在应用程序设计器中具有相同的行为? I'm waiting for closing second window before continuing codes of main window. 在等待主窗口代码之前我正在等待关闭第二个窗口。

The waitfor(second_window, 'close'); waitfor(second_window, 'close'); is not actually waiting for the figure window to close. 实际上并没有等待数字窗口关闭。 Specifying a second input to waitfor tells MATLAB to block execution until the specified property changes or the object is deleted. 指定waitfor的第二个输入告诉MATLAB阻止执行,直到指定的属性更改或删除对象。

MATLAB autocompletes property names if there are enough characters to match a unique name * . 如果有足够的字符匹配唯一名称*, MATLAB会自动填充属性名称。 In your case, 'close' matches the figure's CloseRequestFcn . 在你的情况下, 'close'匹配数字的CloseRequestFcn UI figure objects do not have this property , hence the error. UI图形对象没有此属性 ,因此出现错误。

Call waitfor without the second input to achieve the desired behavior. 在没有第二个输入的情况下调用waitfor以实现所需的行为。


* I'm not sure if this is explicitly stated in MATLAB's documentation anywhere, but the functional equivalent is the PartialMatching property of MATLAB's inputParser class : *我不确定这是否在MATLAB的文档中明确说明,但功能等价物是MATLAB的inputParserPartialMatching属性

Inputs that are leading substrings of parameter names will be accepted and the value matched to that parameter. 将接受作为参数名称的前导子字符串的输入,并且该值与该参数匹配。 If there are multiple possible matches to the input string, MATLAB throws an error. 如果输入字符串有多个可能的匹配项,则MATLAB会抛出错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM