Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Global Variables and Embeded Matlab Functions

Status
Not open for further replies.

claudiodeviaje

Mechanical
Jun 19, 2005
45
Hello...
I working in Simulink with a Matlab Embeded Function and I need to export the values of the variable "A" to the Workspace DURING the simulation.

I tried using a "TO WORKSPACE" block, but the results of the "A" are are sent to the workspace only at the end of the simulation. What I need is sone function that'll send the results DURING the simulation. After a time step is calculated the results should be exported. That means that "A" should be exportet permanently as a scalar and rewriten in every step. The problem is that the embeded matlab function does not support Global Variables.

The reason for this is that in this embeded Matlab function (function 1) I calculate a value which I need to send to another function 2. That means, function 1 exports the value for "A" at time=t. In the next step the function 2 takes the value and send a signal to a valve (open/close).

Is there a way to export a variable globally to the workspace during the simulation in embeded matlab functions?

Thank you in advance

claudio
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor