From OpenSees to Matlab

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

Moderators: silvia, selimgunay, Moderators

Post Reply
andrett7
Posts: 118
Joined: Fri Dec 04, 2009 5:23 am
Location: Politecnico di Milano

From OpenSees to Matlab

Post by andrett7 »

Hi,

I have a question. Is there the possibility to export the variables from OpenSees to Matlab in order to understand in a easy way if their values are correct?
Is there some Tcl commands to do this?

Thanks in advance

Bye
Scientists study the world as it is; engineers create the world that never has been.
zvidrih
Posts: 39
Joined: Wed Apr 30, 2008 1:55 am
Location: Ljubljana, Slovenia

keep it simple

Post by zvidrih »

You can always output the variables using "puts" command to a text file with an *.m extension,

e.g.

set a 1;
set b 2;
set c [expr $a+$b]

set file [open matlaboutput.m a]
puts file "a=$a;"
puts file "b=$b;"
puts file "c=$c;"

close $file

then you can run the "matlaboutput" from matlab...

hope that this is what you're asking for
Zlatko Vidrih
Institute of Structural Engineering, earthquake Engineering and Construction IT
Faculty of Civil and Geodetic Engineering
University of Ljubljana, Slovenia
andrett7
Posts: 118
Joined: Fri Dec 04, 2009 5:23 am
Location: Politecnico di Milano

Post by andrett7 »

Thanks for the suggestions. I'll try

Bye
Scientists study the world as it is; engineers create the world that never has been.
andrett7
Posts: 118
Joined: Fri Dec 04, 2009 5:23 am
Location: Politecnico di Milano

Post by andrett7 »

Thanks zvidirih, now it works.

set a 1;
set b 2;
set c [expr $a+$b];

set name "C:/......./test.m";
set fileid [open $name a]
puts $fileid "a=$a;"
puts $fileid "b=$b;"
puts $fileid "c=$c;"

close $fileid

Bye
Scientists study the world as it is; engineers create the world that never has been.
Post Reply