addPath does not take a vector from genpath
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi.
Im trying to create a Project with the help of a scripts/funktions. The creation works fine, just my code for adding the folders in the Root don't work.
I have the this funktion
function [] = ProjektFolderAdd(folder)
addFolderIncludingChildFiles(currentProject,folder);
addPath(currentProject,genpath(fullfile(pwd,folder)));
end
And i call it like this from a batch file
mkdir Code_Generation
mkdir Simulations_Cachs
mkdir Parameter
mkdir Models
mkdir Models\First_Refrenz_Model
mkdir Models\Second_Refrenz_Model
mkdir Models\General_Purpose_Subsystem
matlab.exe -r "cd C:\Users\Asus\Desktop\code_versuche\Repo_batch\teset2\,
run ('ProjektSetup()'),ProjektFolderAdd('Code_Generation'), exit"
"cd" and "run ('ProjektSetup()')" works, just not the "ProjektFolderAdd('Models')" part.
Models is a folder in the Root of the Projekt and has 3 subfolders.
No folder in the whole path has a space in it and when i pass
addpath(genpath(fullfile(pwd,folder)));
like this it works but will not be a part of the Project.
Error using matlab.project.Project/addPath
The file or folder
"C:\Users\Asus\Desktop\code_versuche\Repo_batch\teset2\Models;C:\Users\Asus\Desktop\code_versuche\Repo_batch\teset2\Models\First_Refrenz_Model;C:\Users\Asus\Desktop\code_versuche\Repo_batch\teset2\Models\General_Purpose_Subsystem;C:\Users\Asus\Desktop\code_versuche\Repo_batch\teset2\Models\Second_Refrenz_Model;"
does not exist.
Error in ProjektFolderAdd (line 5)
addPath(currentProject,genpath(fullfile(pwd,folder)));
Am I missunderstanding how addPath and addpath works or is the vektor from genpath diffrent from what i need?
0 commentaires
Réponse acceptée
Jan
le 20 Nov 2022
According to the documentation https://www.mathworks.com/help/matlab/ref/matlab.project.project.addpath.html addPath() takes one folder as input, not the output of genpath.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Search Path dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!