- adjusting the MATLAB path
- using packages. Unfortunately, there is no way to set a top-level package name and have everything else in the package use some kind of relative access to that: every location inside the code that wants to access a package function needs to either import using the package name, or use the full package-name qualified name.
- defining different classes (which might potentially both derive from the same class)
Can I restrict what path an App looks at for functions, when I have two Apps that use different versions of the same named function?
1 次查看(过去 30 天)
显示 更早的评论
I have developed a set of 4 Applications in App Designer to do particular structural calculations. In the past I had the 4 Apps accessible from one UIFigure via 4 buttons - each of which ran a separate App (by calling its "_exported" m-file. I have now updated all the Apps but want to package these with the old versions (on a separate tab). However, the old and new versions potentially share functions of the same name, but (slightly) different functuionality. Although I have images of all the functions the last time I compiled the Apps, (2 years ago), if I try to compile old and new versions now, then I will potentially run into problems with the old versions trying to use new versions of functions and vice versa.
I have built a simple application (attached) that acts as a switchyard to call 2 versions of another dummy application. One version calls a file foo.m that mutiplies an input by 2; the other version calls a function foo.m (stored in a different folder) that mutiplies its input by 3. I tried to restrict the path at the point were the Apps were created but that didn't work. I haven't tried to compile anything but figure that if I can't get it to work as a stand-alone, I won't get it to work compiled.
Is there a way to restrict what versions of functions an App looks at when running (and/or when being compiled)?
I could compile all the old apps together (with any new versions of functions hidden) and then do the same for the new apps, but really wanted to just have one version with old and new versions on different tabs. Is this possible?
0 个评论
采纳的回答
Walter Roberson
2022-6-16
The MATLAB Path is respected at compile time.
At run time, if you were running interactively, you could adjust the MATLAB path at run-time.
At run time, if you are using compiling, then adjusting the MATLAB path is not recommended.
The mechanisms to control path include:
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Develop Apps Using App Designer 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!