Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Unable to run scripts in current working directory

Subject: Unable to run scripts in current working directory

From: David MacKinnon

Date: 19 Jul, 2010 17:07:04

Message: 1 of 11

After attempting to use addpath (added using the startup.m script) to consolidate some often-used functions under a directory structure, I find myself now unable to run scripts or functions in the current working directory. Prior to this, I was unable to run scripts in directories added using addpath if they contained more than about 5 files. I can run some of the scripts if I create a new directory, but for reasons I have yet to ascertain from experiments, Matlab will "decide" that scripts cannot be run from that directory as well.

Ideas? I am now evaluating Octave because Matlab has become effectively non-functional. If Octave doesn't appear to do the job then I will simply re-install Matlab to see if that fixes the problem.


 

Subject: Unable to run scripts in current working directory

From: Sean

Date: 19 Jul, 2010 17:54:06

Message: 2 of 11

"David MacKinnon" <david.mackinnon@nrc-cnrc.gc.ca> wrote in message <i220no$ick$1@fred.mathworks.com>...
> After attempting to use addpath (added using the startup.m script) to consolidate some often-used functions under a directory structure, I find myself now unable to run scripts or functions in the current working directory. Prior to this, I was unable to run scripts in directories added using addpath if they contained more than about 5 files. I can run some of the scripts if I create a new directory, but for reasons I have yet to ascertain from experiments, Matlab will "decide" that scripts cannot be run from that directory as well.
>
> Ideas? I am now evaluating Octave because Matlab has become effectively non-functional. If Octave doesn't appear to do the job then I will simply re-install Matlab to see if that fixes the problem.
>

One simple possibility could be that your files don't have the '.m' extension. Is it possible that they're saved with a different extension which may be hidden?

Subject: Unable to run scripts in current working directory

From: Andy

Date: 19 Jul, 2010 18:24:06

Message: 3 of 11

"David MacKinnon" <david.mackinnon@nrc-cnrc.gc.ca> wrote in message <i220no$ick$1@fred.mathworks.com>...
> After attempting to use addpath (added using the startup.m script) to consolidate some often-used functions under a directory structure, I find myself now unable to run scripts or functions in the current working directory. Prior to this, I was unable to run scripts in directories added using addpath if they contained more than about 5 files. I can run some of the scripts if I create a new directory, but for reasons I have yet to ascertain from experiments, Matlab will "decide" that scripts cannot be run from that directory as well.
>
> Ideas? I am now evaluating Octave because Matlab has become effectively non-functional. If Octave doesn't appear to do the job then I will simply re-install Matlab to see if that fixes the problem.
>
>
>

Have you tried restoredefaultpath? If that doesn't work, have you called tech support? Either of these seems preferable to re-installation.

Subject: Unable to run scripts in current working directory

From: David MacKinnon

Date: 19 Jul, 2010 18:40:07

Message: 4 of 11

"Sean " <sean.dewolski@nospamplease.umit.maine.edu> wrote in message <i223ft$de5$1@fred.mathworks.com>...
> "David MacKinnon" <david.mackinnon@nrc-cnrc.gc.ca> wrote in message <i220no$ick$1@fred.mathworks.com>...
>
> One simple possibility could be that your files don't have the '.m' extension. Is it possible that they're saved with a different extension which may be hidden?

I'm afraid not. All the files have .m extensions. Specifically, they are files I was executing previously and have not been changed. Same with any new "test" files (single line disp() output files) I create. Moving them to a different directory allows me to run them until Matlab decides to no longer run them.

Subject: Unable to run scripts in current working directory

From: David MacKinnon

Date: 19 Jul, 2010 18:47:04

Message: 5 of 11

"Andy " <myfakeemailaddress@gmail.com> wrote in message <i22586$5uh$1@fred.mathworks.com>...
> "David MacKinnon" <david.mackinnon@nrc-cnrc.gc.ca> wrote in message <i220no$ick$1@fred.mathworks.com>...
>
> Have you tried restoredefaultpath? If that doesn't work, have you called tech support? Either of these seems preferable to re-installation.

I tried restoredefaultpath but it doesn't work. Literally, the script throws an error. Here is the result:

____________________________
??? Error using ==> restoredefaultpath
System error: 'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

Command executed: C:\Program Files\MATLAB704\sys\perl\win32\bin\perl.exe "C:\Program Files\MATLAB704\toolbox\local\getphlpaths.pl" "C:\Program Files\MATLAB704"

Error in ==> restoredefaultpath at 45
    error('MATLAB:restoredefaultpath:PerlError','System error: %s\nCommand executed: %s', ...
_________________________________

It appears that when it calls pearl it doesn't use the DOS 8.3 format for the directory name so halts when it tries to run "C:\Program" part of the call.

I haven't tried tech support yet but will try that once I've run out of options I can do myself.

Subject: Unable to run scripts in current working directory

From: Sean

Date: 19 Jul, 2010 18:53:05

Message: 6 of 11

"David MacKinnon" <david.mackinnon@nrc-cnrc.gc.ca> wrote in message <i226j8$tf$1@fred.mathworks.com>...
> "Andy " <myfakeemailaddress@gmail.com> wrote in message <i22586$5uh$1@fred.mathworks.com>...
> > "David MacKinnon" <david.mackinnon@nrc-cnrc.gc.ca> wrote in message <i220no$ick$1@fred.mathworks.com>...
> >
> > Have you tried restoredefaultpath? If that doesn't work, have you called tech support? Either of these seems preferable to re-installation.
>
> I tried restoredefaultpath but it doesn't work. Literally, the script throws an error. Here is the result:
>
> ____________________________
> ??? Error using ==> restoredefaultpath
> System error: 'C:\Program' is not recognized as an internal or external command,
> operable program or batch file.
>
> Command executed: C:\Program Files\MATLAB704\sys\perl\win32\bin\perl.exe "C:\Program Files\MATLAB704\toolbox\local\getphlpaths.pl" "C:\Program Files\MATLAB704"
>
> Error in ==> restoredefaultpath at 45
> error('MATLAB:restoredefaultpath:PerlError','System error: %s\nCommand executed: %s', ...
> _________________________________
>
> It appears that when it calls pearl it doesn't use the DOS 8.3 format for the directory name so halts when it tries to run "C:\Program" part of the call.
>
> I haven't tried tech support yet but will try that once I've run out of options I can do myself.


'What' is the result of typing:
>>what
into the command window. It should give you m-files and .mat files.

Subject: Unable to run scripts in current working directory

From: Walter Roberson

Date: 19 Jul, 2010 18:58:11

Message: 7 of 11

David MacKinnon wrote:

> I'm afraid not. All the files have .m extensions. Specifically, they are
> files I was executing previously and have not been changed. Same with
> any new "test" files (single line disp() output files) I create. Moving
> them to a different directory allows me to run them until Matlab decides
> to no longer run them.

Do they stop working immediately after you give a "rehash" command?

Is it possible that these directories you are using are underneath one of the
Matlab installation directories? If so that can cause a lot of problems.

Subject: Unable to run scripts in current working directory

From: David MacKinnon

Date: 19 Jul, 2010 19:25:21

Message: 8 of 11

"Andy " <myfakeemailaddress@gmail.com> wrote in message <i22586$5uh$1@fred.mathworks.com>...
> Have you tried restoredefaultpath? If that doesn't work, have you called tech support? Either of these seems preferable to re-installation.

After some testing I will add some information.

First, I was able to run restoredefaultpaths from a DOS window but the problem remains.

Second, although I can't run any functions from the current directory I can use help <fucntionName> to access the help information I put at the start of each file. This was also the case when I encountered the 5-file limit for anything along the added search path: I could access help information from any file but couldn't call the function from either the command line or within a script.

Next: to try the rehash suggestion that arrived as I was writing this...

Subject: Unable to run scripts in current working directory

From: David MacKinnon

Date: 19 Jul, 2010 19:43:28

Message: 9 of 11

Walter Roberson <roberson@hushmail.com> wrote in message <i227et$dmk$2@canopus.cc.umanitoba.ca>...
> David MacKinnon wrote:
>
> Do they stop working immediately after you give a "rehash" command?
>
> Is it possible that these directories you are using are underneath one of the
> Matlab installation directories? If so that can cause a lot of problems.

I checked the PATH statement and there are now only the paths to the toolboxes. Previously they were at the top of the search list (first to be searched).

Just tried rehash and no change.

One thought that has come to mind: The specific error I am receiving is as follows:

__________________________
??? Undefined function or variable 'curvatureDetection'.
__________________________

Could Matlab be halting the search when it discovers there is no variable by this name and not proceeding the the usual next step of checking the current directory?

Consider, if I bypass the local variable search by using run to process the script, I receive this error:

____________________________
run curvatureDetection
??? Error using ==> run
Error using ==> evalin
Undefined function or variable 'curvatureDetection'.
_____________________________

I'm not yet sure if this yields any new insight.

Subject: Unable to run scripts in current working directory

From: Jan Simon

Date: 19 Jul, 2010 19:49:05

Message: 10 of 11

Dear David,

> ??? Error using ==> restoredefaultpath
> System error: 'C:\Program' is not recognized as an internal or external command,
> operable program or batch file.
>
> Command executed: C:\Program Files\MATLAB704\sys\perl\win32\bin\perl.exe "C:\Program Files\MATLAB704\toolbox\local\getphlpaths.pl" "C:\Program Files\MATLAB704"
>
> Error in ==> restoredefaultpath at 45
> error('MATLAB:restoredefaultpath:PerlError','System error: %s\nCommand executed: %s', ...

Something seriously went wrong. RESTOREDEFAULTPATH is thought as an emergency tool, which run even under very strange conditions. Actually the exectuted command should include the perl.exe in double quotes also.

I'd decide for a re-installation of Matlab.
Jan

Subject: Unable to run scripts in current working directory

From: David MacKinnon

Date: 19 Jul, 2010 20:11:19

Message: 11 of 11

"Jan Simon" <matlab.THIS_YEAR@nMINUSsimon.de> wrote in message <i22a7h$pdf$1@fred.mathworks.com>...
> Dear David,
>
> Something seriously went wrong. RESTOREDEFAULTPATH is thought as an emergency tool, which run even under very strange conditions. Actually the exectuted command should include the perl.exe in double quotes also.
>
> I'd decide for a re-installation of Matlab.
> Jan

If tech support has nothing then that is probably what I will have to do.

All the suggestions have been much appreciated. What had started out as an attempt to simply things (using techniques that worked in the past for older versions of Matlab) has turned into a week of headaches. I would still really like to know what went wrong but it appears that some things will have to remain a mystery.

Once again, I appreciate all the attempts to help solve this problem.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us