OpenSim 3.1 - Specifying log file location

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Shaun Fickling
Posts: 13
Joined: Fri Feb 24, 2012 11:48 am

OpenSim 3.1 - Specifying log file location

Post by Shaun Fickling » Tue Aug 06, 2013 6:10 am

Hi there

I am implementing a Forward Dynamics pipeline in MATLAB, using the new API. Is it possible to change the location of (or even periodically clear/delete) the 'err' and 'out' log files when working with multiple models and motion capture trials?

When I start my code, the log files appear in the Current MATLAB Directory. However from then on, regardless of which directory I begin to work in, the output is saved in the same log files. I have to exit MATLAB and restart the program for it to change to another directory, and then the same situation continues.

Am i missing some method or object that allows me to control this output, or at least the location where this output is saved?

Regards,
Shaun

User avatar
David John Saxby
Posts: 83
Joined: Mon May 09, 2011 8:39 pm

Re: OpenSim 3.1 - Specifying log file location

Post by David John Saxby » Wed Aug 07, 2013 5:37 pm

Hi Shaun,

I had a similar issue. I wanted to write the log file for each given operation, rather than overwrite.

What I did was (see below example from a scaling operation):

% Check for the log file
test4linscalelog = dir(fullfile(subjectDir, '*out.log'));

% Condition for copying log
if ~isempty(test4linscalelog)

% Rename the out.log so that it doesn't get overwritten.
% Nice feature if you keep track of fitting error and such.
copyfile('out.log',[subjectDir '\' name 'linear_scaling_out.log'])
end

This worked for me.

Cheers,

David

User avatar
Shaun Fickling
Posts: 13
Joined: Fri Feb 24, 2012 11:48 am

Re: OpenSim 3.1 - Specifying log file location

Post by Shaun Fickling » Thu Aug 08, 2013 1:05 am

Hi David

Thanks for the input, that's pretty much what I'm trying to do. I can copy the 'out.log' file to another name, but I still don't have permission to delete the original. So, when I run the following iterations, it just appends to the end of the original log file (even though my current working directory is now somewhere else).

I've tried using the "clear all" command in MATLAB to try release all links to OpenSim so that I can delete this file but that also doesn't work.

I must be missing something!

Shaun

User avatar
David John Saxby
Posts: 83
Joined: Mon May 09, 2011 8:39 pm

Re: OpenSim 3.1 - Specifying log file location

Post by David John Saxby » Mon Aug 12, 2013 2:51 am

Hi Shaun,

Are you running Windows 7? Are you running Matlab in Administrator mode? I think the permissions might be different between operating systems, not sure though.

David

User avatar
Shaun Fickling
Posts: 13
Joined: Fri Feb 24, 2012 11:48 am

Re: OpenSim 3.1 - Specifying log file location

Post by Shaun Fickling » Tue Aug 13, 2013 4:05 am

Hi David

I managed to get around it by toggling between working directories using the cd command in MATLAB. That way I can run the Tools from the same directory and the log files are always updated there. It's not ideal but it works!

Thank you for your help.

Cheers
Shaun

User avatar
David John Saxby
Posts: 83
Joined: Mon May 09, 2011 8:39 pm

Re: OpenSim 3.1 - Specifying log file location

Post by David John Saxby » Thu Aug 15, 2013 3:53 pm

Hi Shaun,

That is also how my code runs. Some the API execution commands (maybe all not sure) require the path to the directory as input argument. While the write location doesn't seem modifiable, so it probably uses the cd as default.

Glad its working

David

POST REPLY