- Load the 10001x5 matrix into MATLAB base workspace. This just needs to be done once and can be done through a separate M script or the PreLoadFcn callback of the Simulink model.
- In the model, use a Lookup Table block. You will need to make the 10001x5 matrix into the right format.
- The input to the Lookup Table block is the dynamic altitude value, the output would be the weather data.
One-time data import into Simulink
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Panagiotis
el 26 de Jun. de 2023
Comentada: Panagiotis
el 26 de Jun. de 2023
Hello there!
I am trying to import a 10001x5 matrix into Simulink, that contains weather data for different altitudes (each row represents an altitude). This dataset will be used as input to a dynamic model of an aircraft. The problem requires that, based on the current altitude of the aircraft the corresponding row of the dataset should be chosen in order to retrieve the data (wind speed, temperature etc.) for that particular altitude. The dynamic simulation does not have a fixed sample time (or simulation step fro that matter, I don't what the difference is at the moment) and for that reason I find it difficult to use the "From Workspace" etc. blocks that are typically used for such purposes. The best way to treat this kind of data, would be to execute a one-time import into the model workspace and retrieve the data needed based on the method described above. The data are saved as a .mat file using the save() function from matlab and are a product of another matlaba function, not included into the simulation.
Do you have any suggestions? Is there a better way to incorporate such a dataset into the simulation?
P.S. For the time being I am using the load() function inside a matlab function block, but this makes the simulation quite slow. I have also tried importing the data as a timeseries, either by using the corresponding blocks or via the model worskpace (inserting my own matlab script, directly importing the data as a structure). Any suggestions would be valuable!
0 comentarios
Respuesta aceptada
Fangjun Jiang
el 26 de Jun. de 2023
What you need to do are:
The "From Workspace" block is kind of a "Lookup Table" block, but it is "looked up" on time, not on any other variable.
Más respuestas (0)
Ver también
Categorías
Más información sobre Event Functions en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!