Implement vectors of variables in Simulink

조회 수: 1 (최근 30일)
Nicolò Binda
Nicolò Binda 2020년 5월 27일
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ò

답변 (0개)

카테고리

Help CenterFile Exchange에서 Simulation에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by