Running Matlab simulation from a C++ code

8 ビュー (過去 30 日間)
Griffin Polglaze
Griffin Polglaze 2020 年 3 月 14 日
回答済み: Mark McBroom 2020 年 3 月 22 日
I have inhereted a C++ code (source and header files) and am wondering how I would run a simulation based of the data obtained from C++ in Matlab. The purpose of the simulaition is to see how droplets grow over time.

回答 (1 件)

Mark McBroom
Mark McBroom 2020 年 3 月 22 日
Option 1: Modify your C++ code so that it writes the data to a comma delimited file, where the first column is the simulation time and the remaining columns are the output values for each time step. Then, use one of the options discussed here to bring the data into Simulink. https://www.mathworks.com/help/simulink/import-data_import-data.html
Option 2: Create a new Simulink S-Function block that will run our code and has output signals for each of the variables your C++ code computes. This is more of an advanced maneuver. https://www.mathworks.com/help/simulink/slref/c-object-methods-as-legacy-functions.html

カテゴリ

Help Center および File ExchangeEvent Functions についてさらに検索

タグ

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by