Implement vectors of variables in Simulink

1 visualización (últimos 30 días)
Nicolò Binda
Nicolò Binda el 27 de Mayo de 2020
Hi
I've got a Simulink model that rappresent a car moving on a line. The entity is defined as a bus with different properties.
The entity passes into different servers and in every server there are loops that changes parameters.
for example this is part of the entity
entity.door.time_maintenance
entity.roof.time_maintenance
entity.wheel.time_maintenance
So i defined a vector car_parts={'door','roof','wheel'}; in the matlab workspace
And in the server i do a cycle like this:
for j=1:Length_car_parts
entity.(car_parts{j}).time_maintenance=entity.(car_parts{j}).time_maintenance+5;
end
my problem is that i need to define: car_parts={'door','roof','wheel'} in every server before the loops , I have a lot of server and i change this vector frequently so i need to update each server everytime, this takes a lot of time and if i forgot just one server, it causes different errors.
I tried loading this variabile from a matfile but i've got always the same error:
error in 'untitled2/Entity Server' block. See Entry action line 4, column 8.
Caused by:
  • Data type of parameter 'car_parts' is not supported in event actions. For more information about supported data types, see Supported data types in the documentation.
How can i load this vector into the server from the matlab workspace or directly from a .mat?
Many thanks
Nicolò

Respuestas (0)

Categorías

Más información sobre Model, Block, and Port Callbacks en Help Center y File Exchange.

Productos


Versión

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by