How can I programmatically start/stop data logging or enable/disable File Scope block.

10 views (last 30 days)
I have a Simulink program running on an xPC Target computer that logs signals to disk with a File Scope block. However, this program runs for a long time and I only want to log data for short segments intermittently. How can I trigger the File Scope to start and stop logging data? I've looked through this thread but when a signal is not being passed to the scope, the scope still logs data. Just all zeros. I only want the File Scope to log when I choose.
Thank you.

Answers (1)

Rajiv Ghosh-Roy
Rajiv Ghosh-Roy on 26 Mar 2013
There are two possible solutions:
  1. You can set the File scope to be signal triggered, and only activate the trigger signal when you want it to actually trigger. This will then capture data for a short burst (= Number of Samples in the file scope) following each trigger. Note that the triggering only "takes" after the Number of samples have been captured
  2. Put the scope block into an enabled subsystem and feed the enable port with something that controls your logging. The scope will log for exactly those samples that the enable input is true. You should keep the scope's triggering as "Freerun" for this case.

Community Treasure Hunt

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

Start Hunting!