How to run .m file automatically without path?

4 vues (au cours des 30 derniers jours)
Veronika
Veronika le 9 Mar 2017
Commenté : Guillaume le 13 Mar 2017
Dear all,
I have .m file for starting up program. I always have to put (write) the path this .m file. For example: run C:/Program Files/.../file.m. I would like to automatized this action for any PC, without using file path. Is this possible in Matlab?
Thank you for your answers.

Réponse acceptée

Guillaume
Guillaume le 9 Mar 2017
If you don't specify the path to the file, it will have to be in one of the folders on the matlab search path for it to be found. See this page for the folders that are in the search path.
  4 commentaires
Veronika
Veronika le 10 Mar 2017
Okay, but will it works on other computers, where the program eidors has a different path?
Guillaume
Guillaume le 13 Mar 2017
Well, it all depends how you get that program onto other computers. If you use an installer, then either that installer needs to add the folder where it's put to the matlab path, or it needs to put the file(s) in a folder already on the matlab path.
If you copy the program manually, then it's up to you to do the same.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Startup and Shutdown 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!

Translated by