Why do I get an error when trying to run a simulation with a compiled simulink model?
조회 수: 2 (최근 30일)
이전 댓글 표시
This is the code:
Time = (0:99999)';
InputA = rand(100000,1); InputB = rand(100000,1); InputC = rand(100000,1);
InputD = rand(100000,1); InputE = rand(100000,1); InputF = rand(100000,1);
InputG = rand(100000,1); InputH = rand(100000,1); InputI = rand(100000,1);
InputmatrixDouble = [Time InputA InputB InputC InputD InputE InputF InputG InputH InputI];
save('InputmatrixDouble', 'InputmatrixDouble');
[status, cmdout] = system(['Testcase_double.exe -i InputmatrixDouble.mat -tf ', num2str(Time(end)) ,' -o OutputmatrixDouble.mat'])
All inport data types of the model are set to "double", but I get the following error when trying to run the model:
** Starting model 'Testcase_double' @ Thu Aug 31 09:55:02 2017
Error starting model: Data type of matrix variable from MAT-file InputmatrixDouble.mat can only be double while data type of inport 0 is not set to double.
The error message dosn't change when i set the input data type to "Inherit: Auto"
How can I get the model running?
댓글 수: 0
답변 (1개)
Ning Zhang
2017년 9월 6일
편집: Walter Roberson
2017년 9월 6일
Your InputmatrixDouble.mat needs to be a structure, inside of array, as item 2 and 3 shows in the following doc.
Step5 (2) has an example of prepare structure format https://www.mathworks.com/help/releases/R2017a/rtw/examples/using-mat-files-to-feed-data-to-inport-blocks-for-rapid-simulations.html#zmw57dd0e4160
참고 항목
카테고리
Help Center 및 File Exchange에서 Optimize Model Response에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!