App Designer (using uitimescope in standalone app)

10 vues (au cours des 30 derniers jours)
Sune
Sune le 31 Mai 2024
Hello,
I am having trouble getting my app to work when compiled as a standalone app. Specifically, the app is connected to a Simulink model, and I have created a custom "Run" button which creates a simulation object. I then try and bind a signal to a uitimescope. This works fine in App Designer, but when compiled I get an error that no signal is logged at output port 1 of Gain 7. I have included a snippet of the code below. Any suggestions would be very much appreciated!
app.TimeScope = uitimescope(app.UIFigure);
app.simObj = simulation("ModelNameHere","LoadModel",true);
bind(app.simObj.LoggedSignals, [app.simObj.ModelName '/Gain7:1'], app.TimeScope);
start(app.simObj);

Réponses (1)

Ruchika Parag
Ruchika Parag le 26 Juin 2024
Hi Sune,
It sounds like the issue might be related to the way signals are logged in your Simulink model when the app is compiled. Here are a few suggestions to troubleshoot and resolve the issue:
  1. Ensure Signal Logging is Enabled: Make sure that signal logging is enabled for the specific signal you are trying to bind. You can do this by right-clicking the signal in Simulink and selecting "Log Selected Signal."
  2. Check Signal Logging Configuration: Verify that the signal is correctly configured to be logged in the Simulink model. You can do this by opening the "Configuration Parameters" dialog, navigating to the "Data Import/Export" pane, and ensuring that "Signal logging" is checked.
  3. Use Correct Signal Path: Double-check that the signal path you are using in the bind function is correct. Signal paths are case-sensitive and must match exactly.
  4. Model Name Consistency: Ensure that the model name used in simulation and the path used in bind are consistent and correctly referenced.
  5. Compilation Differences: Sometimes, there are differences in behavior between running a model in Simulink and running a compiled version. Ensure that all necessary dependencies and configurations are included in the compiled app.
  6. Error Handling: Add error handling to capture and log more detailed information about the issue when the app is compiled. This can help you diagnose the problem more effectively.
It would be helpful in investigating this issue if you could attach the model and related data.

Catégories

En savoir plus sur Create Apps to Control Simulations dans Help Center et File Exchange

Produits


Version

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by