简体   繁体   English

Matlab GUI:如何添加对接的图形组?

[英]Matlab GUI: how to add docked figure group?

I would like to be able to add a figure container to a matlab gui... 我希望能够将图形容器添加到Matlab GUI ...

In core matlab, with a docked window style you can have a large number of plots stacked one behind the other, all within a figure container with a tabbed list along the side of the container that you can simply click to bring a particular figure to the front. 在核心Matlab中,采用停靠的窗口样式,您可以将大量绘图彼此叠放在一起,所有绘图都位于图形容器中,并且容器侧面带有选项卡式列表,您只需单击即可将特定图形带到图形容器中。面前。

Is there a way to have this sort of figure container in a matlab gui? 有没有办法在Matlab GUI中使用这种图形容器?

Use Ben Tordoff's GUI Layout Toolbox . 使用Ben Tordoff的GUI布局工具箱 It contains functionality for tabbed panels and dockable/undockable panels that can contain figures, and many other capabilities that you'll find very useful if you are creating GUIs in MATLAB. 它包含选项卡式面板和可包含图形的可停靠/不可停靠面板的功能,以及许多其他功能,如果您在MATLAB中创建GUI,这些功能将非常有用。

You will need to organize your GUI code slightly differently, but it's not hard to learn and there are great examples in the documentation. 您将需要稍微不同地组织GUI代码,但是学习起来并不难,并且在文档中有很多示例。

It's not really possible to do what you're describing with just regular MATLAB: figures will just dock into the main MATLAB desktop, not into your GUI specifically. 仅使用常规的MATLAB确实无法完成您要描述的事情:图形只会停靠在MATLAB主桌面中,而不是专门插入GUI中。 The best way (without GUI Layout Toolbox) would probably be to fake a row of tabs using buttons next to each other, with callbacks on the buttons that deleted/hid one plot and drew/revealed another. 最好的方法(没有GUI Layout Toolbox)可能是使用彼此相邻的按钮来伪造一排选项卡,并在按钮上进行回调以删除/隐藏一个图并绘制/显示另一个图。 There is a function uitab that does tabs, but before R2014b it's undocumented, and it's a bit of a pain anyway. 有一个可以执行制表符的功能uitab ,但是在R2014b之前没有记录,反正还是有点痛苦。 Better all round to use GUI Layout Toolbox. 更好地使用GUI Layout Toolbox。

If you're open to play around with undocumented features, this can be done using the java objects behind the matlab figures, eg using a little tool from the fileexchange. 如果您愿意使用未公开的功能,可以使用matlab图形后面的java对象来完成此操作,例如,使用fileexchange中的一个小工具

This will create a new dock group, just like MATLAB's container for figures, editor etc. 这将创建一个新的停靠组,就像MATLAB用于图形,编辑器等的容器一样。

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

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