Use xlsread in Simulink to implement basic parameters
Show older comments
Dear all,
I would like to load information from an xlsx file into Simulink. The "text.xlsx"-file consits of
1 2
3 4
5 6
7 8
9 10
If if read it out in MATLAB using
A = xlsread('bedarf.xlsx');
A(1,1) would be 1, so it works well, but I am not able to include this in an MATLAB Function Simulink Model. I want to use the data as basic parameters, so I have to read them in only once per simulation. My idea, which does not work:
function A = test
persistent A_
if isempty(A_)
A_ = xlsread('test.xlsx');
end
A = A_;
The occuring problems:
The function 'xlsread' is not supported for standalone code generation. See the documentation for coder.extrinsic to learn how you can use this function in simulation.
Function 'test' (#247.61.81), line 5, column 9:
"xlsread('test.xlsx')"
Launch diagnostic report.
Component: MATLAB Function | Category: Coder error
and
Undefined function or variable 'A_'. The first assignment to a local variable determines its class.
Function 'test' (#247.92.94), line 8, column 5:
"A_"
Launch diagnostic report.
Component: MATLAB Function | Category: Coder error
I would be very happy to get a working solution and a common understanding of my mistake.
Best regards, Michael
1 Comment
Michael
on 17 Jul 2014
Accepted Answer
More Answers (0)
Categories
Find more on Function Definition in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!