MATLAB Answers

Proper Treatment of Symbolically Linked Script in Editor

조회 수: 4(최근 30일)
John Schaefer
John Schaefer 17 Jan 2020
댓글: John Schaefer 20 Jan 2020
I have a series of simulations from an external application which all require similar post-processing steps. I use a Linux system, and In order to avoid copy-pasting the same post-processing script around, I've created symbolic links to a single post-processing script from subdirectories where the simulations were run. My directory structure looks something like this:
postFiles/
postProcScript.m
runFiles/
run1/
simResults2Process.txt
post/
postProcScript.m <--- symbolic link to ../../../postFiles/postProcScript.m
run2/
simResults2Process.txt
post/
postProcScript.m <--- symbolic link to ../../../postFiles/postProcScript.m
[...]
runN/
simResults2Process.txt
post/
postProcScript.m <--- symbolic link to ../../../postFiles/postProcScript.m
If the current directory is one of the run/post/ directories, then I can run my symbolically linked postProcScript.m script from the command window. However when I open it in the editor, it does NOT open the symbolic link version, but rather it opens the version in postFiles/. This behavior is undesirable because when I click the run button from the editor or press F5, MATLAB says it can't run the script (in postFiles) because the name shadows the name of the script in the run/post directory.
I have been using Linux symbolic links with MATLAB files for years, and do not remember seeing this behavior in previous versions of MATLAB. I recently started using R2018b -- is there a setting I need to change in the new version which will allow me to edit and run a symbolically-linked script or function?

  댓글 수: 0

로그인 to comment.

답변(1개)

Steven Lord
Steven Lord 17 Jan 2020
Why not just add the directory containing the original preprocessing script file to the MATLAB search path? That will make it callable regardless of which directory is the current directory.

  댓글 수: 1

John Schaefer
John Schaefer 20 Jan 2020
The problem is not whether or not the script is callable. I can still invoke the symbolically-linked script by typing its name on the command window in the run#/post directories.
I am more annoyed/inconvenienced by the fact that when I type 'edit postProcScript.m' from the run#/post directory, MATLAB opens the original file (not the symbolic link) in the editor, so when I click the run button or press F5, the execution fails. Previous versions of MATLAB treated symbolically linked files the same as if the original file was actually in the directory, so this was a non-issue.

로그인 to comment.

이 질문에 답변하려면 로그인을(를) 수행하십시오.

제품


릴리스

R2018b

Translated by