how to display the results from simulink in a table
古いコメントを表示
i want to display my results from my circuit of a simulink model in table not in scope (graphical) ie: for example i want to display the result @ 1sec , and then the result @ 2sec , and then the result @ 3sec and so on
回答 (4 件)
K E
2012 年 5 月 17 日
0 投票
If you do not need your table displayed in real time, you could complete the simulation, save the results to a mat file using the To File block, then load the mat file in Matlab and display a table, or write it out to an Excel file.
Kaustubha Govind
2012 年 5 月 18 日
0 投票
You could set up a model execution event listener that is triggered every time a block's output is computed. This event listener can then update your table. See Listening for Method Execution Events.
Bill Tubbs
2022 年 4 月 5 日
編集済み: Bill Tubbs
2022 年 4 月 5 日
I also prefer working with tables and csv files rather than mat files so I wrote a script to convert a Simulink SimulationOutput object into a MATLAB table with appropriate column headings.
It works like this:
t = Ts*(0:nT)'; % sample times
sim_out = sim(sim_model, t(end));
% Convert results to table
sim_results = convert_simout_2_table(sim_out, t);
Source code here:
It only returns the simulation outputs that were sampled at the same times as the given time vector, so you have to make sure your model outputs are sampled at the correct times.
Armel
2022 年 9 月 29 日
0 投票
Hello,
Could you please explain a little bit how to use your program? And what does he display?
Thanks!
4 件のコメント
Bill Tubbs
2022 年 9 月 29 日
Is this comment intended for me? If you are referring to the code I posted in comment above, go to the GitHub repository and look at the docstring in the code for the function. It provides some explanation of what it does and the arguments. FYI: I haven't tested it recently so not sure if it still works.
Armel
2022 年 9 月 30 日
Yes, it's for you. I've tried to use it but without success. I'll try again but my knowledge in matlab and especially in functions is not sufficient to do it.
Armel
2022 年 9 月 30 日
Hi,
I tried : and this is the error I get :

Is it right to put "out" as input for the function "sim_out"?
Armel
2022 年 10 月 13 日
Hi,
Sorry to disturb you but could you please provide me more information so that I can run this program?
Thanks
カテゴリ
ヘルプ センター および File Exchange で Simulink についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!