Edit vs open from command line

조회 수: 3 (최근 30일)
Aditya Desai
Aditya Desai 2017년 9월 22일
댓글: Aditya Desai 2017년 9월 27일
I have two classes, Sub and Super, where Sub is a subclass of Super. Both m-files are in the same folder (say /path/to/mydir). I noticed a difference between using open and edit from the command line. If the current directory is /path/to/mydir, then using either
edit Sub.m
open Sub.m
open Sub.m in the editor. However, if the current directory is a different one and /path/to/mydir is on the Path, then
edit Sub.m
opens Super.m, while
open Sub.m
opens Sub.m in the editor. What is the difference between using edit or open for m-files?
If it's relevant, I'm using MATLAB R2014b on Linux.

답변 (1개)

Andrew Bliss
Andrew Bliss 2017년 9월 27일
That's odd that edit Sub.m would open Super.m. Perhaps
which('Sub.m','-all')
could help trace the problem?
  댓글 수: 1
Aditya Desai
Aditya Desai 2017년 9월 27일
Using which with the -all option shows the correct Sub.m and nothing else.
I'm not sure if that is relevant but these files are in an SVN repository and I had used svn cp to get them into the current branch from another branch.
This problem of edit opening the wrong file does not occur for other subclass/superclass combinations which were either created inside this folder or copied into it using the regular Linux cp command .

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Software Development Tools에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by