Matlab GUI 自动化? [英] Matlab GUI Automation?

查看:26
本文介绍了Matlab GUI 自动化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设有人使用 GUIDE 制作了一个 Matlab GUI.现在我想在编程环境中使用该代码 - 这不是人在循环中.对我来说,用 GUI 编写人机交互的脚本"以便以适当的顺序操纵各种控件以使工具处理我的数字并获得其结果的最简单方法是什么?我正在寻找一种非侵入性的方式来重用此工具的功能.我调用 Matlab 功能的理想编程环境是 Java.

Lets say someone made a Matlab GUI using GUIDE. Now I want to use that code in a programmatic environment - that is no human-in-the-loop. What's the easiest way for me to "script" the human interactions with the GUI so as to manipulate the various controls in the appropriate sequence to make the tool crunch my numbers and get its results? I'm looking for a non-invasive way to reuse the capabilities of this tool. My ideal programmatic environment for invoking the Matlab functionality would be Java.

我可以打开 GUIDE .fig 并找出各种控件上的所有回调函数,但设计模式似乎是将所有数据推送到 handles 变量中.

I can open up the GUIDE .fig and trace out all the callback functions on the various controls, but the design pattern seems to be to shove all the data into the handles variable.

如果有任何帮助,我可以使用 Matlab Builder JA for Java 生成 Java 类.任何建议将不胜感激.

I've got the ability to use the Matlab Builder JA for Java to generate java classes, if that is helpful in any way. Any suggestions would be appreciated.

推荐答案

MTALAB GUI 是 Java GUI.对于 GUI 自动化,Yair Altman 的博客上有一篇最近的文章:http://undocumentedmatlab.com/blog/gui-automation-robot/

MTALAB GUI is Java GUI. For the GUI automation there is a recent post on the blog of Yair Altman: http://undocumentedmatlab.com/blog/gui-automation-robot/

以下内容仅适用于您可以重写应用程序的情况.

Following applies only if you can rewrite the application.

对于像您这样的任务,通常不需要任何形式的 GUI 自动化.应用程序应具有以下架构:模型->业务逻辑->图形界面.每一层都与其上层分离 - 模型业务逻辑一无所知,而对GUI一无所知.这样就可以以编程方式调用业务逻辑,甚至无需显示 GUI.这里一个在 MATLAB 中实现 MVC 的例子.

There is usually no need for any form of GUI automation for such tasks as yours. Application should have following architecture: Model->Business Logic->GUI. Each layer is decoupled from layers above it - Model knows nothing about Business Logic which knows nothing about the GUI. It is then possible to call Business Logic programmatically without even displaying the GUI. Here is an example for MVC implementation in MATLAB.

因此应避免使用 GUIDE.在 MATLAB 中有一个未记录的 layout manager,有还有一些关于文件交换.

For this reason GUIDE should be avoided. There is an undocumented layout manager in MATLAB, there are also some on the file exchange.

在您的情况下,您可以将整个业务逻辑置于 GUI 逻辑之外,从而使 GUIDE 回调仅调用您的业务逻辑函数.

In your case you could put the whole Business Logic outside the GUI Logic making GUIDE callbacks do nothing but call your Business Logic functions.

这篇关于Matlab GUI 自动化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆