Login  Register

Re: File not located on MATLAB 'path' but correct path is known by MATLAB

Posted by randress on Mar 25, 2021; 5:18pm
URL: http://forum.featool.com/File-not-located-on-MATLAB-path-but-correct-path-is-known-by-MATLAB-tp1037p1041.html

I sent the following to MATLAB:
Please find attached “W10cleanInstall.png”. 
 
It is a screen shot of commands immediately after the initial invocation of MATLAB 2020a.
 
There is a MATLAB script “print_geom_objects.m” located at :
   D:\FEATool\tempwork\scripts

Note that when the commands:
   >>cd D:\FEATool\tempwork
   >>print_geom_objects
are executed, the response is (as expected – since “print_geom_objects.m” is not located 
in the current directory or on the execution path) it is not located and MATLAB responds:
   Unrecognized function or variable ...
 
Then when the commands:
   >>cd scripts
   >>print_geom_objects
are executed, “print_geom_objects” is located and executed, but (as expected) it fails to execute 
properly because of invalid arguments.
 
Following that, note the return of the current working directory to “D:\FEATool\tempwork” 
by  the command:
   >>cd ..

Now comes the surprise of what seems to me to be undocumented/unexplained behavior. 
The command:
   >>print_geom_objects
is (as expected) not located since it is still not on the path or in the current working directory,
BUT WHAT HAPPENS IS VERY UNEXPECTED.  As reported initially, the command/script
“print_geom_objects.m” is correctly located by MATLAB which also formulates ‘cd’ and 
‘addpath’ commands to make the appropriate changes either of which would make the 
command executable.
 
Further note that changing to an empty directory produces the same result.
 
Also (not shown) after executing MATLAB and re-launching it, the behavior does not change.  
From the first attempt, It refuses to execute the command but does locate it including offering
the commands to correct the off-path state.
 
To clarify: my question is NOT why the command is NOT located but why (after initially locating 
it and executing it) MATLAB continues to offer its location even though that location does not 
qualify as an executable one.
 
Thanks,
Randal


Awaiting their reply,
-Randal