How to import several input signals from spreadsheet into one inport?
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Selena Mastrodonato
am 7 Feb. 2024
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.
Antworten (1)
Pramil
am 27 Feb. 2024
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 Kommentare
Siehe auch
Kategorien
Mehr zu Sources finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!