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 »

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 »

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 »

Thank you sir!
Post Reply