有没有办法修改“ ..”的路径。 (快捷方式)?
每当我从其他部门从团队中下载存储库时,他们都会在MATLAB中使用脚本(.m文件),这些脚本(.m文件)是从包含“ ..”(如快捷方式)的路径链接中的路径文件运行的,我不知道如何更改在我的MATLAB工作站上,它是父母目录。例如一个.m文件(脚本),其中包含:
MODEL_CONFIG='..\03_config\config.m';
run(MODEL_CONFIG)
在其工作站上,该代码有效,但在我的工作站上说: “没有.. \ 03_config \ config.m找不到。”
,我知道“ ..”是项目的父目录。我的问题是:
“我如何更改默认的父目录,以便“ ..”也可以在我的工作站上工作?
现在唯一的解决方案是用'c:\ users%user%\ user%\ c:\ users%\桌面\ 19_projectsmatlab \ 99_gsm_oem' - 并且此示例99_GSM_OEM将是父目录。
Whenever I download repositories from my team from other departments they have scripts ( .m files )in MATLAB which are runned from a path file which contain ".." ( like a shortcut ) in their path link and I do not know how to change that on my MATLAB workstation, the parent directory for it. For example an .m file (script) which contains:
MODEL_CONFIG='..\03_config\config.m';
run(MODEL_CONFIG)
On their workstation this code works but on my workstation it says that:
"there is no ..\03_config\config.m not found."
and I know that the ".." is the parent directory from the project. My question is:
"How can I change the default parent directory so that ".." can work on my workstation too?
Right now the only solution is to manually change in every script file the ".." with 'C:\Users%user%\Desktop\19_projectsMatlab\99_GSM_OEM' - and it this example 99_GSM_OEM would be the parent directory.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
..
在路径中的意思是:从MATLAB中的当前工作目录中返回一个文件夹。您可以通过单击如果要在脚本执行期间更改此文件夹,则可以使用
cd'c:/users/yourname/yourfolter/'
What a
in Matlab.
..
means in a path is basically: go back one folder from your current working directory in Matlab. You can easily change this folder by clicking onIf you want to change this folder during script execution you can do this with
cd 'C:/Users/yourname/yourfolder/'
实际上我很愚蠢。 “ ..”就像“ CD ..”中的MS-DOS ....
我一直都在错误的文件夹中。运行主脚本时,我不应该在项目的父目录中。我应该在主脚本正在运行的文件夹目录中(main.m)。
因此,当我在main.m文件的文件夹目录中时,请使用以下链接:
说使用一个文件夹返回main.m文件所在的一个文件夹,并且应该有您访问的文件夹03_config。谢谢你们。
如果您的文件夹中有更多的子文件夹,则是main.m脚本“”。 - 指当前位置。
Actually I am stupid. ".." is like "cd.." in MS-DOS....
I was in the wrong folder all the time. I am not supposed to be in the parent directory of the project when I run the main script. I am supposed to be in the folder directory where the main script is running (main.m).
So when I am in the folder directory of the main.m file the following link:
says go back with one folder from where the main.m file is and there should be the folder 03_config which you access. Thank you guys.
And if you have more subfolders in the folder in which is the main.m script "." - means the current location....
我有同样的问题。
../曾经工作得很好。几年前,我在效果很好的路径和文件表达式中使用了一些旧代码。现在,使用了我的新计算机和Matlab 2022,相同的表达式不起作用并报告相同的问题。
也许Matlab改变了某些内容,并希望他们会注意到这一点并将其更改。
I got the same problem.
../ used to work well. I hade some old code a few years ago using "../" in paths and file expressions that work very well. Now with my new computer and Matlab 2022, the same expression does not work and report the same issue..
Perhaps Matlab changes something, and hope that they will notice this and change it back.