Why can't I remove reference to simulink in app?

22 views (last 30 days)
I accidently added a Simulink component to my app. I removed the component, but I can't remove the refernece to Simulink.
Why do these 4 lines persist when there is no model? Why isn't there an option to remove Simulink in App Designer? I really don't want to recreate my entire projct.
% Public properties that correspond to the Simulink model
properties (Access = public, Transient)
Simulation simulink.Simulation
end

Accepted Answer

Ranjani
Ranjani on 22 Apr 2025
Hi Dan,
This issue has been addressed and will be fixed in a future release. In the meantime, as a temporary workaround, you may use the attached p-coded script (From the zip) to resolve the issue. Provide your mlapp to the function "convertSimulinkAppToStandardApp" and this should remove the Simulink reference.
Please note: This workaround is provided as-is and should be used at your own risk. We advise you to create a backup copy of your app before applying the script.

More Answers (2)

SACHIN KHANDELWAL
SACHIN KHANDELWAL on 21 Apr 2025
Hi @Dan,
I was able to reproduce the issue on my end.
After removing the Simulink components, I could still see those four lines in the MATLAB App Designer code.
A possible workaround in this case is to export the code to a .m file and recreate the MATLAB app. From the 'Designer' tab of your app, go to Save → Export to .m file.
By doing this, you can modify the .m code and remove the unwanted lines.
I hope this workaround helps resolve the issue.

Snehal
Snehal on 21 Apr 2025
Hello @Dan,
When a Simulink component is added to the design view in App Designer, some additional lines of code are added in the corresponding code viewer. Deleting the Simulink component results in deletion of only some of these code lines, not all.
Since these persistent lines of code cannot be manually deleted from the code-viewer directly, possible workaround could be to export this code as a .m file and then edit this newly saved code file in the MATLAB Editor.
Please follow the steps given below to implement the same:
  1. Go to ‘Designer’ tab of your app
  2. Save -> Export to .m file
  3. Open the exported .m file in MATLAB Editor
  4. You can edit this newly created file in the Editor
  5. Click the ‘Run’ button from toolstrip to launch the app directly
For more information please refer to the following MATLAB community discussion:
Hope this helps.

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!