将“.fig”重新定位为使用 Matlab GUIDE 创建 GUI 时的文件
我已经为一些构建脚本开发了一个 GUI,现在正在部署它。由于脚本将在不同的点部署到许多不同的计算机,因此我需要使用团队使用的标准目录格式。
GUI 由包含 UI 视觉定义的“.fig”文件和定义功能的 m 脚本组成。我需要分别在“fig/”和“m/”文件夹中找到这两个文件夹,但我不知道如何做。我首先在 m 脚本中搜索某种包含语句,因为当我单独运行它时,命令窗口中的错误消息指出找不到“.fig”文件,但没有似乎在任何地方都引用了“.fig”文件,我认为这是因为两个文件具有相同的名称但扩展名不同而推断出来的。
我担心 Matlab 的 GUI 系统要求“.m”和“.fig”文件位于同一位置,但这将是一个不优雅的解决方案,如果我可以避免它,我宁愿不采用它。
我要尝试的下一件事是调用一个脚本,该脚本在执行时将Fig文件从其他目录复制到与m脚本相同的位置,然后在脚本退出后删除该副本,这又似乎这是一个笨重的解决方案,但可以让我遵守团队的组织惯例。
还有其他人知道指定 GUI“.fig”文件相对位置的未记录方法吗?
I've developed a GUI for some build scripts, and am now in the process of deploying it. As the script will be deployed to a number of different machines at various points, I need to use the standard format of directories that the team use.
The GUI consists of a ".fig" file that contains the visual definition of the UI, and a m-script that defines the functionality. I need to locate these two in "fig/" and "m/" folders respectively, but I can't figure out how to. I first searched for an include statement of some kind in the m-script, as when I Run it on its own, the error message in the command window states that the ".fig" file can't be found, but there doesn't seem to be a reference to the ".fig" file anywhere, I assume that it's inferred as both files have the same name but a different extension.
I fear that Matlab's GUI system requires that both ".m" and ".fig" files are in the same location, but this will be an inelegant solution that I'd rather not go for if I can avoid it.
The next thing I'm going to try is to call a script that copies the fig file from the other directory to the same location as the m-script, when it is executed, then deletes that copy once the script exits, which again seems a clunky solution, but will allow me to adhere to the team's organisation conventions.
Does anyone else know of an undocumented means of specifying the relative location of a GUI ".fig" file?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以将 GUIDE 生成的 GUI 导出为单个
.m
文件。查看此博客文章:指南GUI 位于一个文件中。我不确定这是一项新功能,还是一直存在的功能之一...
You can export the GUIDE-generated GUI as a single
.m
file. Check out this blog post: GUIDE GUIs in All One File.I'm not sure if this is a new feature, or one of those things that has always been there...