I have saved a pathdef file ('pathdef_etc.m') which contains the paths that I need for a given project. I simply want to get the string output from this pathdef file, so that I can add it to my current path using 'addpath( path_string )'.
The output is a single cell containing a n-by-1 cell array of character vectors (one per line in the input file). So C{1}{1} contains the first line of your file, C{1}{2} the second, and so on. You could then set up a loop to add each line to the path:
Hi, thank you for the answer! I will give this a try.
It is just that I think there is a really straightforward answer. I saw it implemented once, I just can't remember how. It was almost as simple as just clicking the pathdef file in the file explorer, then addpath(ans) or something like that.
When I click the pathdef.m file, it opens up a function p=pathdef , which includes the pathdef search results (all the folders in path), and in the header says..
% PATHDEF returns a string that can be used as input to MATLABPATH
% in order to set the path.
Which makes me think it should be simpler, without any parsing or looping.
However, your help/code has gotten me halfway there so thanks alot! This may work fine.
Impossible de terminer l’action en raison de modifications de la page. Rechargez la page pour voir sa mise à jour.
Translated by
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.