Extracting entity attributes from a batch and using it as an input to a simulink or matlab function?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Sundar Aditya
am 13 Aug. 2019
Beantwortet: Samatha Aleti
am 16 Aug. 2019
In my SimEvents simulation, the entities have an attribute x. I need to compute a function f(input_array) on a 50-element array of x values. I'm using the batch generator block to create a batch of 50 entities, but how do I extract the attribute array to input to f(), which is implemented as a matlab function?
0 Kommentare
Akzeptierte Antwort
Samatha Aleti
am 16 Aug. 2019
Hi,
According to my understanding you want to access the entity attributes in MATLAB. To do this, You may save the entity attributes to MATLAB workspace using “assignin” and then pass it as one of the input arguments to the function as you mentioned.
You can save the entity attributes to MATLAB Workspace by calling the following code in the event actions of a SimEvents Block:
coder.extrinsic('assignin');
assignin('base', 'out’, entity);
“out" is the variable in workspace where the values of entity are saved.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Discrete-Event Simulation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!