Appdesigner: Remove Simulink dependency
40 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Giulio Giovannetti
il 7 Ago 2024
Commentato: Giulio Giovannetti
il 21 Ago 2024
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
0 Commenti
Risposta accettata
Rahul
il 8 Ago 2024
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.
Più risposte (2)
Evelyn
il 8 Ago 2024
Modificato: Evelyn
il 11 Ago 2024
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.
Christopher
il 17 Ago 2024
Does anyone have a solution to removing the Simulink dependency? It cannot be manually removed due to the grayed out App Designer code.
Vedere anche
Categorie
Scopri di più su Simulink Environment Customization in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!