when i package app and simulink file,why have this error

18 次查看(过去 30 天)
function startupFcn(app)
start_simulink
end
% Button pushed function: Button
function ButtonPushed(app, event)
%创建模型输入
simInp = Simulink.SimulationInput('untitled');
simInp = simInp.setVariable('a',app.EditField.Value);
simInp = simulink.compiler.configureForDeployment(simInp);
%执行并取出结果
simOut = sim(simInp);
b=simOut.b;
app.EditField_2.Value=b;
end
this is my code in app,and the package error is
Preparing Runtime...
mcc -o app1 -W 'WinMain:app1,version=1.0' -T link:exe -d C:\Users\admin\Desktop\322\new\app1\for_testing -v C:\Users\admin\Desktop\322\new\app1.mlapp -a C:\Users\admin\Desktop\322\new\test.m -a C:\Users\admin\Desktop\322\new\untitled.slx -r D:\matlab2023\toolbox\compiler\packagingResources\default_icon.ico
Compiler version: 8.6 (R2023a)
Analyzing file dependencies.
Unable to build Simulink Rapid Accelerator target.
mcc failure

回答(1 个)

Kothuri
Kothuri 2024-9-23,12:49
Hi Bx,
I understand that you are facing error when trying to package app and Simulink file.
The error message indicates that there is a problem with building the Simulink Rapid Accelerator target while attempting to package your MATLAB application using the MATLAB Compiler. And suggests that there's an issue with building the compiled version of your Simulink model (untitled.slx).
You can try the below steps to rectify the error:
  • Ensure that the Simulink model is set to use a fixed-step solver as Rapid Accelerator mode requires this configuration.
  • Check for any blocks or features in the model that are not supported by Rapid Accelerator mode and modify these blocks if necessary.
  • Make sure that all variables used in the Simulink model are defined in the base workspace, data dictionary, or model workspace. Even though variables are specified in the SimulationInput object, they need to be available during the Rapid Accelerator build.
  • Try running the Simulink model in Rapid Accelerator mode independently to ensure it works without errors before packaging.
You can refer the below links for more info

类别

Help CenterFile Exchange 中查找有关 Deploy Standalone Applications 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by