App Designer (using uitimescope in standalone app)

10 次查看(过去 30 天)
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);

回答(1 个)

Ruchika Parag
Ruchika Parag 2024-6-26
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.

类别

Help CenterFile Exchange 中查找有关 Create Apps to Control Simulations 的更多信息

标签

产品


版本

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by