input parameters from matlab
Moderators: silvia, selimgunay, Moderators
-
- Posts: 14
- Joined: Fri May 07, 2010 4:51 pm
- Location: Notre Dame
input parameters from matlab
Hi
in my work i need to call opensees through matlab. Althought i know how to do that (! Opensees.exe scriptname.tcl
) i do not know how to call my input parameters for opensees through matlab. For example i input a load in matlab and then i need opensees to use this value.
Thank you in advance
in my work i need to call opensees through matlab. Althought i know how to do that (! Opensees.exe scriptname.tcl
) i do not know how to call my input parameters for opensees through matlab. For example i input a load in matlab and then i need opensees to use this value.
Thank you in advance
-
- Posts: 71
- Joined: Fri Nov 06, 2009 6:40 am
- Location: Universidad del Norte, Colombia
Re: input parameters from matlab
If you are working on an unix-based system, then you can link matlab with opensees by using a fifo pipe... e.g. open two shells (I am using two bash shells here for simplicity)...
On shell #1, write:
% mkfifo pipe # creates a pipe file.
% echo "This message will be sent to shell #2" > pipe
On shell #2, write:
% cat < pipe
to display on screen the message sent from shell #1.
google: fifo unix for more information.
Hope it helps.
On shell #1, write:
% mkfifo pipe # creates a pipe file.
% echo "This message will be sent to shell #2" > pipe
On shell #2, write:
% cat < pipe
to display on screen the message sent from shell #1.
google: fifo unix for more information.
Hope it helps.
-
- Posts: 14
- Joined: Fri May 07, 2010 4:51 pm
- Location: Notre Dame
-
- Posts: 71
- Joined: Fri Nov 06, 2009 6:40 am
- Location: Universidad del Norte, Colombia
What I have done (which is not nearly as sophisticated as the previous suggestion) is to use matlab to create my .tcl script using the input parameters from matlab. Then, run that script from matlab using the !OpenSees.exe command.
For example, when I create a recorder file in matlab:
fid = fopen('recorders.tcl', 'wt')
fprintf(fid, 'recorder Node -file $dataDir/DFree.out -time -dT $dTrec -node %4.0f %4.0f -dof 1 2 3 disp; \n' , freeNodes)
... lots more fprintf lines
fclose(fid)
then call "recorders.tcl" in my main .tcl model script that i will run.
For example, when I create a recorder file in matlab:
fid = fopen('recorders.tcl', 'wt')
fprintf(fid, 'recorder Node -file $dataDir/DFree.out -time -dT $dTrec -node %4.0f %4.0f -dof 1 2 3 disp; \n' , freeNodes)
... lots more fprintf lines
fclose(fid)
then call "recorders.tcl" in my main .tcl model script that i will run.
-
- Posts: 14
- Joined: Fri May 07, 2010 4:51 pm
- Location: Notre Dame
-
- Posts: 4
- Joined: Mon Nov 12, 2012 2:10 pm
- Location: University of Mohaghegh Ardabili
Re: input parameters from matlab
When I call OpenSees from a Matlab script, I face this error:
invalid command name "pattern"
While running the same code (pattern Plain 1 Linear {...}) just through the Opensees works correctly.
How can I fix it?
Thank you in advance
invalid command name "pattern"
While running the same code (pattern Plain 1 Linear {...}) just through the Opensees works correctly.
How can I fix it?
Thank you in advance
-
- Posts: 916
- Joined: Mon Sep 09, 2013 8:50 pm
- Location: University of California, Berkeley
Re: input parameters from matlab
It may be a compatibility issue due to Matlab version. Generally running OpenSees from Matlab would slow down the analysis. A better approach is to create all the loops in tcl and run different cases directly using the for loops in tcl.