Borrar filtros
Borrar filtros

Cant use variable size of bus member vector Simulink

2 visualizaciones (últimos 30 días)
Timo
Timo el 3 de Feb. de 2023
Comentada: Timo el 6 de Feb. de 2023
Hello,
I have a bus object (<Quiver>) with a nested bus object (<arrows>). This nested bus object is a vector of size L (here, 100).
It looks like this:
I now want to reduce the length of this nested objects vector, so I do something like this:
Then I want to reuse the bus type like a <Quiver> again, but with a different length of <arrows>. But this wont work:
  1. It will be created as a virtual bus, thus will not be treated as a struct (like I want it to).
  2. I then take a To Virtual Bus element and set the output bus type to non-virtual. This also throws an error because one of the inputs/outputs must be declared as a Bus Type object. I cant do that, because the Bus Type Object <Quiver> has an length of <arrows> of L (here, L), not the length I just reduced it to.
  3. In the Type Editor, I cant change the length of the vector of the nested bus type object to "variable" (`DimensionsMode` != Fixed). This is very hindering in accomplishing my goals.
How can I achieve what I intend to do?
Thank you very much in advance!

Respuesta aceptada

Mark McBroom
Mark McBroom el 5 de Feb. de 2023
It is not possible to change the length of a fixed length bus element. One approach to work around this would be to create a new variable that keeps track of the used size of <arrows> elelment... in this case any value from1 to 100. You could then use this new variable down stream when you want to loop over all of the used elements in <arrows>
  1 comentario
Timo
Timo el 6 de Feb. de 2023
This is very unfortunate but I get what you propose. Thank you very much!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Deployment, Integration, and Supported Hardware en Help Center y File Exchange.

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by