import timetable to simulink in matlab

To import a Timetable to Simulink, you can make use of the from command that is available in the Simulink Model Explorer window. Follow the below steps to achieve this:

  1. Ensure that you have a valid timetable in your workspace. If you don't have one, you can create one using the timetable function in matlab.
main.m
myTimetable = timetable((1:10)',randi(10,10,1),'VariableNames',{'Time','Value'});
82 chars
2 lines
  1. Open the Simulink Model Explorer window. This can be achieved by right-clicking on an open Simulink model and selecting Model Explorer.
  2. In the Model Explorer window, select Data Import/Export > From Workspace.
  3. A new From Workspace window will be opened. Select the Data Type as Timetable.
  4. In the Workspace Variable field, type the name of the timetable that you want to import.
  5. Click on the Import button.

Your timetable data will be imported to Simulink and can be used in your model.

gistlibby LogSnag