How to use app designer to import a drive cycle and feed into simulink Model ?

3 views (last 30 days)
Hi Team,
Wanted help on how to import or select single or multiple drive cycles using matlab app desinger and then feed that into simulink model.

Accepted Answer

Dhruv
Dhruv on 18 May 2023
Edited: Dhruv on 18 May 2023
To import a drive cycle using MATLAB App Designer and feed it into a Simulink model, try following these general steps:
1. Create an App Designer GUI in MATLAB:
• Launch MATLAB and open App Designer by typing “appdesigner” in the MATLAB command window.
• Design your GUI interface by adding necessary components such as buttons, file selection dialog, etc.
2. Add a file selection component:
• Drag and drop a "Button" or "Browse Button" component from the App Designer toolbox onto your GUI.
• Set the appropriate properties for the button, such as the button text and callback function.
3. Implement the file selection callback function:
• Double-click on the button component to open the code editor for its callback function.
• Write MATLAB code to handle the file selection process. You can use the “uigetfile” function to open a file dialog and let the user select the drive cycle file. Refer: Open file selection dialog box - MATLAB uigetfile (mathworks.com)
4. Pass the selected file to Simulink:
• Once the user selects the drive cycle file, you can use the obtained file path to import the drive cycle data in MATLAB.
• In your Simulink model, you can create an input signal block and provide the drive cycle data as the input to your model.
For more detailed information and examples, you can refer to the following documentation:

More Answers (0)

Categories

Find more on Modeling in Help Center and File Exchange

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!