Function not running except from the source directory
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I saved my code in a directory which has been added to the pathdef.m file. But function call is not working from any other directory. I have to cd to the file source directory to run the code, but the code itself is running fine. What am I doing wrong?
Thank you!
0 comentarios
Respuestas (2)
Star Strider
el 6 de Mzo. de 2015
I can’t tell from here, but if you saved your code to your user path (on Windows machines, C:\Users\USERNAME\Documents\MATLAB\), and used the addpath function if you saved it to a new subdirectory in that directory, you should be able to run it without problems.
0 comentarios
Image Analyst
el 6 de Mzo. de 2015
If you type
>> path
on the command line, do you see the folder with your source code listed there? If you do, it should run no matter what your "current folder" currently is because it will be on your search path.
2 comentarios
Image Analyst
el 6 de Mzo. de 2015
What do you mean "when you run it from c:\"? Is this a compiled program (standalone executable) or are you running an m-file source code from within the MATLAB development environment?
Ver también
Categorías
Más información sobre Search Path en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!