Appdesigner: Remove Simulink dependency

조회 수: 47 (최근 30일)
Giulio Giovannetti
Giulio Giovannetti 2024년 8월 7일
댓글: Giulio Giovannetti 2024년 8월 21일
Hi everybody,
I have accidentaly added a Simulink component to my app and now I cannot compile it anymore.
I have the MATLAB compiler but not the Simulink compiler, to overcome the problem I have removed the simulink component but the dependency is still there, hence the appdesigner does not allow me to compile the app.
Is there any trick that I can use to fix this problem?
Best regards,
Giulio

채택된 답변

Rahul
Rahul 2024년 8월 8일
I was able to reproduce your issue at my end.
As mentioned by you, after removing a Simulink component from the AppDesigner app, the Simulink dependancy still exists and might cause an issue if Simulink compiler is not present.
I have created a basic AppDesigner app to reproduce this issue:
This app only contains a Simulation Controls component in it's UI Figure.
After adding this component to the app, in the 'Code view' of the app we can see additional code for establishing dependancies with Simulink:
Additional code in 'Code View' 1:
% Properties that correspond to app components
properties (Access = public)
UIFigure matlab.ui.Figure
SimulationControls simulink.ui.control.SimulationControls % This line is added to set the properties of the component which is added
end
Additional code in 'Code View' 2:
% Public properties that correspond to the Simulink model
properties (Access = public, Transient)
Simulation simulink.Simulation
end
% These public properties are established corresponding to the Simulink
% model connected
Additional code in 'Code View' 3:
% Construct app
function app = app1
% Associate the Simulink Model
app.Simulation = simulation('sim');
% Create UIFigure and components
createComponents(app)
% Register the app with App Designer
registerApp(app, app.UIFigure)
if nargout == 0
clear app
end
end
% Inside the app function, the app.Simulation = simulation('') line is
% added which establishes the connection of the app with the Simulink model.
%Here my Simulink model's name is 'sim.slx' that's why 'sim' is mentioned
%in the simulation function.
After removing the Simulation Controls component from the app, we can see in the 'Code view' of the app that the Additional code added in 'Code view' 1 is removed, however the Additional code added in 'Code View' 2 and 3 still exists and is creating the Simulink dependency.
A possible workaround for this case can be:
From the 'Designer' Tab of your app you can go to Save -> Export to .m File. This step is required as you cannot manually make changes to the code in the 'Code View' app, however you can edit a .m file according to your needs.
So after creating a .m File for your app, you can remove the lines containing Additional code in 'Code View' 2 and 3.
This would remove the dependency of Simulink from your app in your .m file. You can now run your app by running the .m File.
Hope this helps! Thanks.
  댓글 수: 1
Giulio Giovannetti
Giulio Giovannetti 2024년 8월 8일
Thank you @Rahul for the support!
As far as I understood, this process allows the dependency removal but the exported m-version app cannot be imported again so I could no longer use the appdesginer for further improvemenet. By the way I can continue developing my app with the appdesigner and implement this process just to compile the app.
In any case, I have just opened a bug fixing issue with Mathworks.

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Evelyn
Evelyn 2024년 8월 8일
편집: Evelyn 2024년 8월 11일
Hello @ tiny fishing,
To remove the Simulink dependency from your app and allow it to compile successfully using the MATLAB Compiler, you can try the following steps:
1.Clean Up Unused Functions and Blocks:
  • Make sure that you remove any unused functions or blocks from your app that might still be referencing Simulink components.
2. Check Dependencies in AppDesigner:
  • Open your app in AppDesigner and go to the "Code View" tab.
  • Manually inspect the code to ensure there are no references to Simulink components.
3. Update Compiler Options:
  • Check the compiler options in the MATLAB Compiler to ensure that it is not trying to include Simulink dependencies.
4. Rebuild the App:
  • Try rebuilding your app after making sure that all references to Simulink components are removed.
  댓글 수: 1
Giulio Giovannetti
Giulio Giovannetti 2024년 8월 8일
Thank you Evelyn for your support!
Using the dependency analyzer tool I found some lines referring Simulink in the class definition properties.
% Public properties that correspond to the Simulink model
properties (Access = public, Transient)
Simulation simulink.Simulation
end
Unfortunately, these lines cannot be deleted manually...

댓글을 달려면 로그인하십시오.


Christopher
Christopher 2024년 8월 17일
Does anyone have a solution to removing the Simulink dependency? It cannot be manually removed due to the grayed out App Designer code.
  댓글 수: 1
Giulio Giovannetti
Giulio Giovannetti 2024년 8월 21일
While waiting for this issue to be fixed I am following @Rahul's suggestion.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Simulink Environment Customization에 대해 자세히 알아보기

제품


릴리스

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by