How to use different path in different folder
Mostra commenti meno recenti
As all known, when we set MATLAB search path, we can use the function in that search path.
However if we have different projects, and their functions are same name, but these functions are slightly different. Eg.
C:\project1\myadd.m
C:\project1\mymul.m
C:\porject1\myconv.m
C:\project1\detector\svm.m
C:\project2\myadd.m
C:\project2\mymul.m
C:\porject2\myconv.m
C:\project2\detector\svm.m
When we work in project1 folder, we can add project1 to search path. When we work in project2 folder, should we remove project1 from search path and add project2 to path?
I found this answer How can I run scripts with the same name, that are contained in different folders?
It seems to solve my question, but when the project is very large, it seems don't work, espically I clone other's code.
So, I just want to using corresponding search path when I work in different folders easily .
I tried to save search path as `pathdef.m` to working folder, but it doesn't work.
Risposta accettata
Più risposte (1)
Walter Roberson
il 9 Mag 2019
0 voti
Use /private folders. Those can only be used by routines in closely related directories.
Or perhaps you should be creating classes that happen to provide a number of similar method names.
Or perhaps you should use packages and import()
Categorie
Scopri di più su Workspace Variables and MAT Files in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!