如何使用弹出菜单和uitable?

发布于 2024-10-16 16:37:13 字数 1008 浏览 8 评论 0原文

我有一个弹出菜单和一张桌子。弹出菜单用于选择用户将使用的生成器。例如,如果用户想要使用2个生成器,则用户可以在弹出菜单上选择“2”。如果用户选择2,则该表将发出2×3的表。如果用户选择三个生成器,则该表将发出 3 x 3 的表。如果用户选择四个生成器,则该表将发出 4 x 3 表,依此类推。我的问题是我希望这种情况如何适用?我的意思是,当用户选择“2”时如何生成 2 x 3 表,当用户选择“3”时如何生成 3 x 3 表,依此类推?

供您参考,我的项目是关于经济调度的。我必须使用 4 个生成器构建 GUI,并且每个生成器都有限制。所以我必须做2个uitables。因此,用户选择的每个发电机,然后用户必须为每个发电机插入限制(以兆瓦为单位)(这是另一个表)

这是我的表的示例(4×3):

      Alpha   Beta  Gamma

C1

C2

C3

C4

发电机的方程式是:

C1 = (Alpha) + (Beta)P + (Gamma)P^2

C2 = (Alpha) + (Beta)P + (Gamma)P^2

C3 = (Alpha) + (Beta)P + (Gamma)P^2

C4 = (Alpha) + (Beta)P + (Gamma)P^2

这是每个发电机的限制表:

  Lower  Upper

C1

C2

C3

C4

该表的形式为:

Lower < C1<上 下

< C2<上 下

< C3<上 下

< C4<上

所以当用户选择“2”时,它将弹出 2 x 3 表。我想怎么做?它的代码是什么以及我想如何将表数据调用到按钮中?好吧,我已经制作了 2 个合适的数字,并且我已经设置了表属性,例如行名称和列名称。但我想让它只有两行怎么办?

请帮我解决这个问题。

I have a popup menu and a table. Popup menu is to select a generator that will be used by the user. For example if the user wants to use 2 generators, then the user may select '2 'on the popup menu. If the user select 2, then the table will be issued a 2 by 3 table. If users select three generators, then the table will be issued a 3 by 3 table. If users select four generators, then the table will be issued a 4 by 3 table and so on. My question is how i want this situation applies? What I mean is how to produce a 2 by 3 table when the user select '2' and 3 by 3 table when the user select '3' and so on?

For your info, My project is about economic dispatch. I have to build GUI using 4 generators and each of the generator have limit. So i have to make 2 uitables. So each generator user selected, then the user have to insert limit( in megawatt) for each generator(which is another table)

This is the example of my table(4 by 3):

      Alpha   Beta  Gamma

C1

C2

C3

C4

The equation for the generator is :

C1 = (Alpha) + (Beta)P + (Gamma)P^2

C2 = (Alpha) + (Beta)P + (Gamma)P^2

C3 = (Alpha) + (Beta)P + (Gamma)P^2

C4 = (Alpha) + (Beta)P + (Gamma)P^2

This is a table for the limit of each generator:

  Lower  Upper

C1

C2

C3

C4

The form of this table will be :

Lower < C1 < Upper

Lower < C2 < Upper

Lower < C3 < Upper

Lower < C4 < Upper

So when the user select '2', then it will popup the 2 by 3 table. How i want to do it? What is the code for it and how i want to call the table data into the pushbuttons? Well i already make 2 uitable figures and i already set the table properties like the row name n column name. But how i want to make it only 2 row only?

Please do help me on this.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

尐籹人 2024-10-23 16:37:13

我也在学习 MATLAB GUI :P
我还没有使用任何弹出窗口或模式对话框,但使用 uitable() [ http ://www.mathworks.com/help/techdoc/ref/uitable.html ] 您可以定义表格,然后调整属性 [ http://www.mathworks.com/help/techdoc/ref/uitableproperties.html]。
例如,要拥有 N 行,您需要设置表的数据,即

set(table, 'Data', zeros(n, 3));

这将为您提供一个 x 3 表。

我会开始使用 GUIDE 来感受它。然而,GUIDE 对我来说似乎太混乱了。一段时间后,我选择使用 GridLayout [ http://www.mathworks.com/matlabcentral /fileexchange/29472-gridlayout ] 并定义我自己的类。

I'm in the process of learning MATLAB GUI too :P
I haven't yet used any popups or modal dialogs, but using uitable() [ http://www.mathworks.com/help/techdoc/ref/uitable.html ] you can define your table and then adjust the properties [ http://www.mathworks.com/help/techdoc/ref/uitableproperties.html ].
For example, to have N rows, you would set your table's data, i.e.

set(table, 'Data', zeros(n, 3));

That would give you a n x 3 table.

I would start playing around with GUIDE to get a feel for it. However, GUIDE just seems too messy for me. After a while, I opted for using GridLayout [ http://www.mathworks.com/matlabcentral/fileexchange/29472-gridlayout ] and defining my own classes.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文