Importing excel spreadsheet into Simulink (configuration parameters pane)

Hi
I have a question regarding importing data from excel spreadsheet into the Simulink inport. I have 1 sheet with 54 column, the first column corresponds time and the rest are time dependent parameters. As I found out, first I should convert the excel file into the mat file and then import it from configuration parameters>> Data import/export. The problem is that I don't see any place called edit data as I see in other versions, (I am using a rather old version of Simulink). I attached a print screen of that page from both versions. I really appreciate if you would give me a hint regarding that.
Best Regards, Elham

Answers (2)

Could you just import it into MATLAB (completely outside of Simulink) using the Import tool or importdata or xlsread and then write it to a MAT file from there?

4 Comments

What I actually did was that I directly imported the excel sheet from the Matlab import data and saved it as a mat file. Then I opened the Simulink and tried to import this mat file.
I think you need to use one of the model callbacks to load the MAT file into the workspace. Then you can refer to the variables in the above image where you have the mat file name since these variables will live in the workspace.
Thank you for your reply. I tried this also: mydata=xlsread('mydata.xls'); save('mydata.mat','mydata'); and in the configuration parameters>>input/export data I inserted: mydata.mat when I run the Simulink file I get this error:
I have no idea what I did wrong. I appreciate any help.
Best Regards, Elham
In the model properties -> callbacks, run:
load mydata.mat;
And then put the variable name that's inside of mydata.mat where you have the input now.

Sign in to comment.

Thank you for your reply. It didn't run by using callbacks either. Finally I could make it work by creating vectors from each column in Import Wizard and inserting as a matrix of variables in Configuration parameters>> import/export data. Since I have 54 variables it is not a smart way to do that. The best is to insert one excel sheet into the Demux block. Please let me know if it is possible.

2 Comments

I finally solved it. Thank you for the time. I appreciate it.
Gr8 that you solved. I've similar situation but cannot achieve it. i've 3 input for fuzzy logic controller; listening, oral_communication, written_comunication. I have made 3 columns in excel and have a single sample row. how do i input the three columns data into 3 respective inputs in simulink. Plz help me...

Sign in to comment.

Asked:

on 18 Dec 2013

Community Treasure Hunt

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

Start Hunting!