How to pass variables from one file to another?

Hello all, I have two function file in matlab (not in simulink even though the picture is in simulink. Plus, the solvers I am using to solve my optimal control problem are not compatible with simulink). I have function file for block 1 fn U=guidance(X). And 2 files for 2nd block, i.e fn X=state_propagation(U) and run file of this function. I am having troubling closing the loop, i.e. the output U(vector) from first block (function) is a input to the second function and output X from second function is the input to the first function. How can I close both these variable passing loops from one file to another. Can someone please help?

3 Comments

Thanks. This is helpful. What is the reason for NOT using global variables, assignin or evalin?

Sign in to comment.

Categories

Find more on Configure Simulation Conditions in Help Center and File Exchange

Asked:

DB
on 27 Apr 2018

Commented:

on 2 May 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!