Setting up matlab scripting enviroment

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
User avatar
kristen jakubowski
Posts: 15
Joined: Tue Jun 19, 2012 10:40 am

Setting up matlab scripting enviroment

Post by kristen jakubowski » Tue Jun 10, 2014 4:09 pm

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

User avatar
jimmy d
Posts: 1375
Joined: Thu Oct 04, 2007 11:51 pm

Re: Setting up matlab scripting enviroment

Post by jimmy d » Wed Jun 11, 2014 11:41 am

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

User avatar
kristen jakubowski
Posts: 15
Joined: Tue Jun 19, 2012 10:40 am

Re: Setting up matlab scripting enviroment

Post by kristen jakubowski » Mon Jun 23, 2014 10:47 am

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

User avatar
Dan Kritzer
Posts: 2
Joined: Tue Jun 17, 2014 7:55 am

Re: Setting up matlab scripting enviroment

Post by Dan Kritzer » Thu Jun 26, 2014 7:20 am

Have you had any luck Kristen? I'm trying to do the same and am getting the exact same error.

User avatar
kristen jakubowski
Posts: 15
Joined: Tue Jun 19, 2012 10:40 am

Re: Setting up matlab scripting enviroment

Post by kristen jakubowski » Thu Jun 26, 2014 2:43 pm

No I haven't had any luck resolving the issue successfully.

Let me know if you do!

Thanks
Kristen

User avatar
jimmy d
Posts: 1375
Joined: Thu Oct 04, 2007 11:51 pm

Re: Setting up matlab scripting enviroment

Post by jimmy d » Thu Jun 26, 2014 3:59 pm

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
Last edited by jimmy d on Mon Jun 30, 2014 2:41 pm, edited 1 time in total.

User avatar
kristen jakubowski
Posts: 15
Joined: Tue Jun 19, 2012 10:40 am

Re: Setting up matlab scripting enviroment

Post by kristen jakubowski » Mon Jun 30, 2014 12:31 pm

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

User avatar
Sarah Roelker
Posts: 7
Joined: Mon Sep 24, 2012 10:09 am

Re: Setting up matlab scripting enviroment

Post by Sarah Roelker » Tue Sep 30, 2014 8:35 am

Kristen,

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

Thanks,
Sarah

User avatar
Wasim Malik
Posts: 2
Joined: Fri Mar 01, 2013 7:12 pm

Re: Setting up matlab scripting enviroment

Post by Wasim Malik » Wed Oct 01, 2014 7:04 am

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

User avatar
kristen jakubowski
Posts: 15
Joined: Tue Jun 19, 2012 10:40 am

Re: Setting up matlab scripting enviroment

Post by kristen jakubowski » Sun Oct 05, 2014 7:32 am

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

POST REPLY