Importing data into Simulink from a file or the Matlab workspace

3 views (last 30 days)
Hello,
To give a little backstory to my problem I am currently trying to run a co-simulation with Simulink and Carsim where I am using a Neural Network as a driver model. Since that model did not run on my first attempt I began to troubleshoot by just passing some ordinary data through the network in Simulink, at first it didn't like the fact that I didn't have a row containing time data which I was easily able to add to the dataset. I then passed the data through the network however when I looked at the output I noticed it only seemed to be outputting a small amount of data so I then put a scope on the input side and noticed that only about 50 or so data points were being passed through to the network, this occured when importing data from both the workspace and from a file. To simplify things even further I created my own simple array in the workspace and imported it to simulink and noticed that it was taking each element of the row and viewing them as constants.
So at the end of the day my question is how do I setup the model such that it views each row of data as a continuous dataset rather than each entry as a constant. I'm also a little bit confused as to how Simulink reads data and whether or not it expects the data in rows or columns.After reading some of the answers on here it seems to contradict what is written in the help files. The help file would seem to indicate that Simulink expects the data to be in rows however some of the answers on here suggest that Simulink expects the data in column form, I know for sure that neural networks in Matlab expect rows. If anyone could provide some clarification regarding these issues and if anyone has any experience co-simulating using neural networks and Carsim I would really appreciate some input.
Thank you, André

Answers (1)

Guy Rouleau
Guy Rouleau on 24 Jun 2011
I recommend going through this documentation section:
You will see about 10 subsections covering different ways to import data in a simulation, depending on the tasks you are trying to do and the type of data.

Community Treasure Hunt

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

Start Hunting!