Azzera filtri
Azzera filtri

Why i receive this warning : Warning: Variable 'needed' exists in base workspace or data dictionary but not in the model's source workspace.

21 visualizzazioni (ultimi 30 giorni)
I want to run an optimization problem using GA, the optimization will be runned for multiple cases of study using For statement.
An objective function (myfitness) is written for the fitness functions and this function will run a Simulink model using a command line as follow
options=simset('SrcWorkspace','current''DstWorkspace','current');
sim('untitled2.slx',[],options)
The whole program is runned by a Main script in which another function 'function 2' is called to define some data and variables to be used in the fitness function (myfitness).
When the main script is runned, i got this warning and the simulation stops
' Warning: Variable 'needed' exists in base workspace or data dictionary but not in the model's source workspace. '
The variable 'needed' is obtained by calling the 'function 2' , i understand that Simulink don’t have the access to this variable , but i can see that this variable is on the workspace.
What is the solution please and what is the cause of the problem.
Best

Risposta accettata

djedoui Nassim
djedoui Nassim il 11 Dic 2018
Modificato: djedoui Nassim il 11 Dic 2018
The solution is to use the output variables from the function 2 as global, and the problem is solved

Più risposte (0)

Prodotti


Release

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by