How to make Display block show values while running sim 'outputs' command
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
I have a simulink model with a lot of displays attached to wires that I am calling through a script. At first I check if the model is compiled. If not, I run the following command
feval(bdroot,[],[],[],'compile');
after that I build my input arrays, called 'ut' and then I evaluate my model to get the outputs
yt = feval(bdroot,0,[],ut,'outputs');
And I correctly get my outputs at 'yt' and I run the 'term' command
My problem is that when I look into the model, none of my Displays show a value different from zero. When the model is compiled, they don't show any value. After I run the 'outputs', they show zero. They only show values different from zero if I run a simulation in time.
Is there any way to make them show the value when I evaluate the model through the 'outputs' command?
Thanks
0 Kommentare
Antworten (1)
Moksh
am 8 Nov. 2023
Hi Augusto,
I understand that you are trying to capture the display values, but the model is not showing changes when it is compiled. This may be occurring because the model might be updating the values during a simulation run and not during the model evaluation using the “feval” command.
You can try using the “sim” command in MATLAB which allows to simulate the model and captures outputs without opening the Simulink interface.
Here is an example pseudocode for this:
% Check if the model is compiled
if ~isdeployed
% Compile the model
feval(bdroot,[],[],[],'compile');
end
% Build input arrays
ut = ... % Your input array
% Simulate the model and capture the outputs
simOut = sim(bdroot);
% Access the outputs
yt = simOut.get('yt');
% Display the outputs
disp(yt);
For more information about the “sim” function please refer to the following MATLAB documentation:
Hope this information helps resolve the issue.
Best Regards,
Moksh Aggarwal
0 Kommentare
Siehe auch
Kategorien
Mehr zu Arduino Hardware finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!