Page 1 of 2

Setting up matlab scripting enviroment

Posted: Tue Jun 10, 2014 4:09 pm
by jakubk2
I am trying to set up matlab scripting. I have followed the instructions given, however I keep getting the error

>> configureOpenSim
Error using fopen
Invalid filename.

Error in configureOpenSim>edit_path_txt_file (line 89)
fopen(fileID,'%s\n',char(Cnew{1}{i}));

Error in configureOpenSim (line 56)
edit_path_txt_file(classFile,OpenSimJarPath)

any ideas how to resolve this issue?

Thanks
Kristen

Re: Setting up matlab scripting enviroment

Posted: Wed Jun 11, 2014 11:41 am
by jimmy
Hi Kristen,

The copy of this file, distributed with opensim, reads

Code: Select all

 fprintf(fileID,'%s\n',char(Cnew{1}{i})); 
at line 89.

I replicated the error you're seeing by editing the file and changing fprintf to fopen.

Hope that helps,
-james

Re: Setting up matlab scripting enviroment

Posted: Mon Jun 23, 2014 10:47 am
by jakubk2
Hi James,

When I make that change I still get the following errors,

Code: Select all

>> configureOpenSim
Error using fprintf
Invalid file identifier.  Use fopen to generate a valid file
identifier.

Error in configureOpenSim>edit_path_txt_file (line 89)
        fprintf(fileID,'%s',char(Cnew{1}{i}));

Error in configureOpenSim (line 56)
    edit_path_txt_file(classFile,OpenSimJarPath)
Im not sure how to resolve the issue.

Thanks
Kristen

Re: Setting up matlab scripting enviroment

Posted: Thu Jun 26, 2014 7:20 am
by dkritzer86
Have you had any luck Kristen? I'm trying to do the same and am getting the exact same error.

Re: Setting up matlab scripting enviroment

Posted: Thu Jun 26, 2014 2:43 pm
by jakubk2
No I haven't had any luck resolving the issue successfully.

Let me know if you do!

Thanks
Kristen

Re: Setting up matlab scripting enviroment

Posted: Thu Jun 26, 2014 3:59 pm
by jimmy
I haven't been able to replicate this issue. This may occur because you don't have admin privileges to edit the file. Perhaps check this first.

Saying that, it may be with the permissions used by fopen().

You can test by changing line 78;

Code: Select all

fileID = fopen(txtname);
to read;

Code: Select all

fileID = fopen(txtname,'r+');
let us know if that works.

-james

PS. Also, in the mean time, the instructions for setting up the environment manually are still on the confluence

Re: Setting up matlab scripting enviroment

Posted: Mon Jun 30, 2014 12:31 pm
by jakubk2
I was able to fix the problem by changing the admin privileges of my computer, the change you suggested did not work. however, changing the setting in the control panel was successful.

thanks
Kristen

Re: Setting up matlab scripting enviroment

Posted: Tue Sep 30, 2014 8:35 am
by schloemer7
Kristen,

Can you be more specific about how you changed the admin privileges on your computer to resolve this error?

Thanks,
Sarah

Re: Setting up matlab scripting enviroment

Posted: Wed Oct 01, 2014 7:04 am
by wmalik
In newer versions of Matlab, the java class directory paths should go into a file called javaclasspath.txt in your preferences folder (which you can find using 'prefdir' in Matlab). I believe the 'librarypath.txt' and 'classpath.txt' file structure is no longer supported by Matlab, as I get a warning in Matlab 2014a.
-Wasim

Re: Setting up matlab scripting enviroment

Posted: Sun Oct 05, 2014 7:32 am
by jakubk2
Sarah where you able to get it to work?

If you can't get the script to run, you can follow the directions on setting up the environment manually, and that should work

Kristen