Calling Opensees by 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
Naseralavi
Posts: 1
Joined: Tue Jul 17, 2012 3:22 am

Calling Opensees by Matlab

Post by Naseralavi »

When I call Opensees by Matlab through the command:
!opensees filename.txt
In the command window of Matlab, an error is reported as:
'opensees' is not recognized as an internal or external command operable program or batch file
Meanwhile, the current directory of Matlab is truly adjusted. Noteworthy, Opensees can directly execute the corresponding text file without any problem.
Would you please guide me where the problem is? :roll:
Note that Version of Opensees in 2.3.1 and version of Matlab is 7.
fmk
Site Admin
Posts: 5884
Joined: Fri Jun 11, 2004 2:33 pm
Location: UC Berkeley
Contact:

Re: Calling Opensees by Matlab

Post by fmk »

OpenSees is not obviously set up on your default path .. either set you path env variable or type the full path to OpenSees

!"C:\Users\PEER Center\bin\OpenSees" Example.tcl
Clbarely
Posts: 1
Joined: Sun Jul 22, 2012 7:13 pm
Contact:

Re: Calling Opensees by Matlab

Post by Clbarely »

In the command window of Matlab, an error is reported as:
'opensees' is not recognized as an internal or external command operable program or batch file

I met this situation before.
linguan118
Posts: 140
Joined: Sun Oct 03, 2010 11:36 pm
Location: Hong Kong

Re: Calling Opensees by Matlab

Post by linguan118 »

you should throw OpenSees.exe into your tcl file folder
Research Assistant Professor, The Hong Kong Polytechnic University
guanlin@polyu.edu.hk
linguan118
Posts: 140
Joined: Sun Oct 03, 2010 11:36 pm
Location: Hong Kong

Re: Calling Opensees by Matlab

Post by linguan118 »

throw OpenSees.exe into your .tcl file folder
then type
system ('opensees *.tcl');
Research Assistant Professor, The Hong Kong Polytechnic University
guanlin@polyu.edu.hk
pinnark
Posts: 1
Joined: Thu Dec 08, 2011 6:43 am
Location: ROSE School

Re: Calling Opensees by Matlab

Post by pinnark »

dear all,
I would like to call OpenSees by Matlab, but my name file is a variable in the Matlab script and I cannot figure out how I could solve the problem...

!OpenSees.exe namefile.tcl does not work in my case because namefile changes at each iteration of my Matlab script.

Waiting for a piece of advice

thanks a lot:-)
linguan118
Posts: 140
Joined: Sun Oct 03, 2010 11:36 pm
Location: Hong Kong

Re: Calling Opensees by Matlab

Post by linguan118 »

pinnark wrote:
> dear all,
> I would like to call OpenSees by Matlab, but my name file is a variable in
> the Matlab script and I cannot figure out how I could solve the problem...
>
> !OpenSees.exe namefile.tcl does not work in my case because namefile
> changes at each iteration of my Matlab script.
>
> Waiting for a piece of advice
>
> thanks a lot:-)
try this:
s1=strcat('opensees ','namefile','.tcl');
system (s1);
it may work.
Research Assistant Professor, The Hong Kong Polytechnic University
guanlin@polyu.edu.hk
Hessan
Posts: 1
Joined: Sat Jan 05, 2013 11:09 am
Location: university of kurdestan

Re: Calling Opensees by Matlab

Post by Hessan »

hi, you can use this
for k=1:20
mySACfile = sprintf('Opensees SAC%d.tcl\n', k);
s1=strcat(mySACfile);
system (s1);
end
it may help you
diptiranjanmajhi
Posts: 3
Joined: Wed Mar 19, 2014 12:39 am
Location: IIT Roorkee

Re: Calling Opensees by Matlab

Post by diptiranjanmajhi »

Hello everyone,
I need some help to run OpenSees programs using Matlab if I want to vary some variables(OpenSees program) in every run.

Thank you.
fmk
Site Admin
Posts: 5884
Joined: Fri Jun 11, 2004 2:33 pm
Location: UC Berkeley
Contact:

Re: Calling Opensees by Matlab

Post by fmk »

either you need to create a new script with the variables inside or pass the variables as inputs to the program through the argv variables when starting opensees from matlab
hamiddehnavi
Posts: 5
Joined: Tue May 31, 2016 10:39 pm
Location: Tehran

Re: Calling Opensees by Matlab

Post by hamiddehnavi »

use !opensees.exe
Toutant
Posts: 32
Joined: Mon Sep 09, 2013 10:33 am
Location: École Polytechnique de Montréal

Re: Calling Opensees by Matlab

Post by Toutant »

I found the easiest way for me was to create a text file from Matlab and then call OpenSees.exe from Matlab using !OpenSees.exe and source the text file generated by Matlab from my main tcl script. This can be included into a for loop in Matlab to run multiple analysis.
Post Reply