MATLAB won't run a code even when in directory containing the code

I try to run a code initially from my home directory. Matlab states that the code exists in a specific folder and I should navigate to that folder OR add that folder to my path. Neither of these options works.
The permissions of the code in the folder is set to execute. As a test, I can run the code from the Linux prompt and it will execute (but of course fail because it's a Matlab code not a Linux executable). I just do this to prove executable status...
Images show the output. Any idea why Matlab would not run a code that is set to executable?

5 Comments

As a simple test, please set your current folder in MATLAB to the indicated folder and attempt to execute generateNetbatchProfile. If you still get an error, please run the pwd command in MATLAB and share a screenshot of the result.
@Cris LaPierre see attached. Even when in the directory where the code resides, it will not run...
Can you run any other fucntions in that folder?
@Cris LaPierre But I can execute any of them at the Linux prompt, so they are executable via Linux...

Sign in to comment.

 Accepted Answer

generateNetbatchProfile is not a Mathworks-supplied function -- at least not that I can find documented or in any toolbox that I have installed. (I can't rule out something undocumented in Parallel Server)
I suspect that it might have been installed by other forces outside of Mathworks.
As such, you might need to
rehash toolboxcache
because MATLAB will normally ignore anything dropped into the toolbox directories that does not go through the regular installers.

4 Comments

@Walter Roberson that worked!! Thanks!!
The code was written with Mathworks to be used with the Parallel Server, but is specific for my company, so it does not have online documentation...
Hi @Paul Safier. To add to @Walter Roberson's solution, MATLAB caches the toolbox path, so that it doesn't continously check for updates in the folder (slowing performance), as it's unlikely it will be modified (sans installations of new toolbox). By rehashing the toolbox cache, MATLAB will pick up new files that may have been added along the way. This is different than files outside of the MATLAB toolbox folder, where MATLAB will check the timestamp to see if it's been updated since the file was last byte compiled.
If the MathWorker wrote a User Guide, I'd be suprised if it didn't have something in there akin to
>> rehash toolboxcache
>> % Initial Netbatch profile with Remote Queue and Remote Qslot
>> generateNetbatchProfile('pdx_abc','/ptm/def');
Side note: MATLAB .m files are text files and don't need their executable bit set (though you will see some files with read and executable enabled). It's enough to have just the read bit enabled.
@Raymond Norris. Thanks for the extra info. Yes, I see the user guide now; oops. :)

Sign in to comment.

More Answers (0)

Categories

Products

Release

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!