I have the following Simulink model:

I would like to externally provide inputs u[k] and y[k], i.e., I will be running simulations via MATLAB command line. I found previously that I could set the [LoadExternalInput and ExternalInput][3] options, and they default to the vector [t u].
But my u[k] and y[k] are vectors, and it looks like the ExternalInput can only specify one vector. So each row of [t u] is the value of the entire vector u at time t.
The sizes of u[k] and y[k] in my model here are not necessarily known ahead of time. Is there a way to pass in these vectors (as structs, perhaps)?
From Importing Data to Root-Level Input Ports I’ve found that I could do something like
where
uandyare structures with fieldstime,signals.values, andsignals.dimensions; each row ofsignals.valuesis a vector corresponding to a n element oftime.signals.dimensionsis the dimension ofsignals.values. I have to manually set the In1 ports to expect the same dimension asu.signals.values(well, I can of course do it programatically before hand..):(from "Importing Data Structures to a Root-Level Input Port")
What’s the point of setting
signals.dimensionsif I have to set the dimension on the In1 block manually anyhow? Anyway that might have to be how I do this: just examineuandybefore running the simulation, then setting the Inblock properties (programatically, of course) to expect vectors of that length.I am still hoping there is a more elegant solution for this.