In Simulink Callback How to Automatically Display a Table of results, like what one can do with figure; plot()
5 ビュー (過去 30 日間)
古いコメントを表示
I am trying to display the results of a simulink simulation model that reads and writes to simulated memory.
I have a function call to display these results, as a table, in the StopFcn callback in the model.
The callback will open figures and plot data automatically but I can't do the same with a table.
I would like the user/tester to be able to see the results pop up in table form (such as with figure;plot()) and not have to go search for a table in the workspace.
Example, How to pop up this table automatically
0 件のコメント
回答 (1 件)
Ninad
2023 年 9 月 15 日
Hi Kathy,
To display the results of a Simulink simulation as a table in a pop-up window, you can use the `uitable` function in MATLAB.
I have created a dummy Simulink Model using a `sine wave` block along with a `Scope` block.
Add the following function in a MATLAB (.m) file:
function myStopFcnCallback(simout)
% Extract the simulation results
data = simout.tout;
% Create a new figure
figure;
% Create a uitable to display the results
uitable('Data', data, 'Position', [20 20 400 300]);
end
In the Simulink Model, call the function defined above through the Stop Function Callback. To do so, go to:
Model Settings (dropdown) > Model Properties > StopFcn*
Write this in the `Simulation stop function` text box to the right side:
myStopFcnCallback(out);
I have attached the `demoTable.slx` model along with the `myStopFcnCallback.m` script file for your reference.
Reference:
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Programmatic Model Editing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!