Use spreadsheet with datetimes as a source input in simulink.

Hello
I could use some help trying to use data from a excel file / csv file as an input source for my simlulation.
The file contains the columns datetime, triage, priority, and an example of that looks like this:
2017-08-20 07:53:00,orange,4
2017-08-20 08:09:00,green,2
2017-08-20 08:17:00,yellow,3
2017-08-20 08:23:00,green,2
2017-08-20 08:24:00,yellow,3
2017-08-20 08:25:00,green,2
2017-08-20 08:41:00,green,2
2017-08-20 08:50:00,green,2
2017-08-20 09:17:00,yellow,3
2017-08-20 09:19:00,yellow,3
2017-08-20 09:22:00,yellow,3
2017-08-20 09:25:00,yellow,3
2017-08-20 09:33:00,green,2
2017-08-20 09:37:00,green,2
2017-08-20 09:40:00,green,2
In our simulation, we have an entity "patient" which is connected to a waiting queue (not FIFO, but based on priority)
I'm trying to provide data for the patient entity, and use the datetimes, so an event should be generated in that timeframe (minutes)
so the second event (2017-08-20 08:09:00,green,2) will be fired 18 minutes after the first event (2017-08-20 07:53:00,orange,4)
What i have tried is to use the import module from a spreadsheet, but we are getting an error that we need to convert our datetimes to numeric values. I'm just not sure how to do that correct.
simulation.png
Hope someone can help

댓글 수: 1

Did you manage to find a way to get datetime inputted into simulink

댓글을 달려면 로그인하십시오.

답변 (1개)

Mark McBroom
Mark McBroom 2018년 11월 24일

0 개 추천

Try changing the format of the date column in your excel spreadsheet to "general". THis will represet the date as number of days since 1900. Assuming your are using date/time for relative calcuations, then you can then use this number directly in your Simulink model. If your algorithm needs absolute time, you'll have to add 1900 to the value.
Note that MATLAB has a function to convert Excel time to MATLAB date-time. https://www.mathworks.com/help/matlab/ref/datetime.exceltime.html

카테고리

제품

릴리스

R2018b

질문:

2018년 11월 20일

댓글:

2022년 5월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by