In Simulink demo sldemo_absbrake, the plotys are generated without using blocks. How did they do it?

 Risposta accettata

It is done via Simulation Data Inspector. If you click on the icon on the yout and slip signal in the model, Simulation Data Inspector pane will open up and there you will see signals automatically logged and plotted at the end of the simulation. Data Inspector's job is to plot them automatically at the end of the simulation.
Also, if you go to File->Model Properties->Model Properties->Callbacks->StopFcn, you will see the necessary command to plot the logged signals. Check those callbacks to see actually what is going on.
Hope this helps.

5 Commenti

Thanks a lot!I found it. I am learning Simulink. In my own model, I need to plot automatically,so I need somehow to enter similar command.How c an I do it? The command in sldemo_absbarake is: if exist(sldemo|_absb rake_output?) sldemo_absbrakeplots exit THANKS!!!
Can you share the model so that it will be easier for me to explain?
Thanks! Please, change the file extension to slx The plots are generated and displayed automatically; this is what I'd like to have...
Try this. The basic workaround for it is to use To Workspace block, log the data and plot the variables automatically at the end by the code used in StopFcn. Check what I wrote there.
Thanks! It is working, indeed! I am attaching an original file with a model and some remarks on page 37. It is still puzzling me, but can be a hint for you. How to re-do this idea? JK

Accedi per commentare.

Più risposte (2)

Hallo My Friend, I found an m file, which includes the info on generating the plots without blocks: sldem_absbrakeplots.m (attached) Also there is a project summary in: https://www.mathworks.com/help/simulink/examples/modeling-an-anti-lock-braking-system.html
Now, I need to learn, how to incorporate an m file into a Simulink model... Could you use this m file and plot without blocks??? Best- JK
A bit of clarification on the comment that mentions the Simulation Data Inspector:
The Simulation Data Inspector does not plot any data automatically at the end of the simulation and is not related to the plots generated when you simulate sldemo_fuelsys. As the comment pointed out, the model uses the callback StopFcn and an attached m file to create the figures.
You can also quickly view logged signals using the Simulation Data Inspector. Clicking the logging badge on the signal selects the signal to plot and opens the Simulation Data Inspector at the same time. If you open the Simulation Data Inspector using the button on the Simulink Editor toolstrip, no signals are plotted, and you can select signals to plot and inspect using the checkboxes next to the signals.

7 Commenti

Thanks, Sara. My question would be: how to associate an sldemo_absbrakeplots.m file (containing all info on plots) with a Simulink .slx model. Also, how to create StopFcn callbacks (just type it in Model Prtoperties-> Callbacks ?). Thasnks- JK
Why don't you do what I already told you in my answer?
Hi, I sincerely appreciate your involvement in my question, but the original question was, if I can remind you, how to generate plots WITHOUT extra blocks. Your suggestion from March 25 was to use To Workspace block. Which I sincerely appreciate, but I am looking for a classical association of the sldemo_absbrakeplots.m file. As in original sldemo solution. Without any extra block. Best regards- JKK
I found the ...plots.m file,and the ...data.m file in C:\....MATLAB' ....sldemo subdirectory. I think I get your advise now: just write the commands in Callbacks and the system will find the files. THANKS! JK
Yes exactly. I have been trying to say that. Glad you solved your problem. You can accept my answer if it helped.
And one supplementary question: how does the system know, where to find the ...plots.m and ...data.m files? Is the default directory set somewhere? The Callbacks commands do not specify files directory Thanks- JK
...I found out the answer. The files are/must be located in the model directory. Thanks for your time and for Callbacks idea. JK

Accedi per commentare.

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by