Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

Is it possible in Simulink for Fixed step discrete simulations (lets say it does 10 iterations) to save a variable only after conditions are met, so that output var has variable size (any size between 0 and 10)?

1 visualizzazione (ultimi 30 giorni)
I am working on a real-time event-detection system for tokamaks. The detector will run during the entire time of the plasma discharge. It uses a fixed sample time as the detector will run on a computer node which executes the code every 1e-4[s].
For simplicity let's say that in total the detector will do 10 iterations. Currently all the signals that are stored will be of length equal to 10 (every iteration it saves a value).
This that the variable for "TimeOfDetection" will consists of values -1 when no detection occurred, and it will store the actual time of detection when in fact a detection has occurred.
However, this is not optimal and it would be better if only a value is if a detection has occurred, so that for example the length of TimeOfDetection is equal to 3 (if 3 detections have occurred), with as values only the detection times and no -1's to fill the other entries.
I already looked at triggered and enabled subsystems, but these systems seem to store an output during every cycle. I understand that normally you store a value at every iteration, so that you know by iteration number to which time a value corresponds, but if you are storing times as values themselves this is unneccessary.
So if anybody has any clever insights or ideas please let me know!
Thanks,
Ricardo

Risposte (1)

Suhan
Suhan il 29 Ago 2017
The triggered subsystems may help you in this. These subsystems are executed only when its activation condition is satisfied. You can use 'To Workspace' blocks inside these subsystems to save your data.

Questa domanda è chiusa.

Community Treasure Hunt

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

Start Hunting!

Translated by