Using Tcl lists outside of Opensees

Forum for OpenSees users to post questions, comments, etc. on the use of the OpenSees interpreter, OpenSees.exe

Moderators: silvia, selimgunay, Moderators

Post Reply
simonkey
Posts: 27
Joined: Thu Feb 18, 2010 6:15 pm
Location: UC Berkeley

Using Tcl lists outside of Opensees

Post by simonkey » Mon Jun 28, 2010 1:57 pm

Hi,

I have a list in my current Tcl file that I would like to use in my Matlab script for post-processing.

How can I get a hold of this list?

Thanks

hugo_esquivel
Posts: 71
Joined: Fri Nov 06, 2009 6:40 am
Location: Universidad del Norte, Colombia

Re: Using Tcl lists outside of Opensees

Post by hugo_esquivel » Mon Jun 28, 2010 2:24 pm

It is pretty simple...

In OpenSees:

set list {1 2 3 4 5}
set fid [open list.txt w]
puts $fid $list
close $fid

In MATLAB:

fid = fopen('list.txt', 'r');
list = fscanf(fid,'%f');
fclose(fid);

Regards.

simonkey
Posts: 27
Joined: Thu Feb 18, 2010 6:15 pm
Location: UC Berkeley

Post by simonkey » Mon Jun 28, 2010 2:54 pm

Thank you sir!

Post Reply