How to import several input signals from spreadsheet into one inport?
조회 수: 4 (최근 30일)
이전 댓글 표시
Hello, I have an excel file with the first column of time and 30 other columns with signals I want to import to my simulink model. I’m interested in using root level inport but since they are 30 signals I would like to have just one inport that receives them all. They are simple signals of type double. I’ve tried setting the inport block to dimensions = 30 and using the Root Inport Mapper Tool but I’m unable to map the 30 signals into 1 inport (even though the inport has dimension 30)… is there a way to do this?
댓글 수: 5
Selena Mastrodonato
2024년 2월 7일
I took for granted that you had 30 different signals, but the example you are showing refers to a multidimensional signal.
In the first case, I remain in the opinion that it is impossible to do this with Root Inport Mapper. I can suggest the 'From Spreadsheet' block and then group the signals so that you have a single inport. But all depends on what you have to do with the signals.
답변 (1개)
Pramil
2024년 2월 27일
To import the signals through a single “inport” block, you can do the following:
- Extract the data from the excel sheet by using the “readtable” function and then separate it into “t” and “other” signals. (Code for this can be set in the “PreLoadFcn” in “Model Properties ->Callback functions” accessible under “Modelling” tab).
- Open the parameter window of “inport” block by double clicking it, go to “Signal Attributes” and set the “port dimensions” to 30. (If you are storing the other signals say in a variable “other”, you can specify the “port dimensions” as “size(other,2)” so in future, if you add or delete a column you do not have to manually change the “port dimensions)”.
- Now open the “Model Settings -> Data Import/Export” and check the “input” checkbox and enter “[t,other]” as your inputs. This will allow you to input all the signals through a single “inport” block.
I have attached an example Simulink model and excel sheet which you can refer to for better understanding.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Load Signal Data for Simulation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!