wolfram-mathematica - Wolfram 中的动态操作函数?
问题描述
我正在为模拟滤波器设计的数字 GUI 编写演示。由于演示只允许一个 Manipulate 函数,有没有办法动态更新我的 Manipulate 控件?
例如,我有 4 种不同的滤波器类型(低通、高通、带通、带阻),前两种只需要两个频率输入,而后两种需要四个频率输入。有没有办法在不嵌套 Manipulates 的情况下根据选择的模式在两个 Manipulate 滑块和四个之间切换?或者,我可以全部四个并在不需要时将两个灰显吗?
解决方案
这是一个动态更改Manipulate
控件的示例,应该易于修改以实现您想要的。不是我写的,也不记得在哪里看到的。
Manipulate[
{x, yyy},
{{x, a}, {a, b, c, d}, None},
{{yyy, 0.5}, 0, 1, None},
{{type, 1}, Range@3, None},
PaneSelector[{
1 -> Column[{
Control@{x, {a, b, c, d}, RadioButtonBar},
Control@{{yyy, 0.5}, 0, 1},
Control@{type, Range@3}
}],
2 -> Column[{
Control@{x, {a, b, c, d}, SetterBar},
Control@{yyy},
Control@{type, Range@3}
}],
3 -> Column[{
Control@{x, {a, b, c, d}, PopupMenu},
Control@{{yyy, 0.5}, 0, 1},
Control@{type, Range@3}
}]
}, Dynamic@type]
]
推荐阅读
- sql - SQL Server 2014 中的字符串 agg 与 group by
- twilio - 我遇到用户名不能为空错误的问题
- javascript - 如果外部 JavaScript 库不可用,使用本地备份?
- maven - 使用已发布的工件时,Maven 依赖关系解析如何工作?
- python-sphinx - 带有 ReadTheDocs 主题的 Sphinx 文档:文本块换行
- java - 如果文件正在被 inpustream 读取,则删除文件不会引发 IOException
- python - 登录表单不起作用。我无法以客户身份登录
- flutter - 定期从服务器唤醒颤振应用程序
- android - 使用 viewModelScope 进行网络请求时跳过 X 帧
- node.js - Nodemon 重新启动后 Express-session 不会持续存在