How can I make an enabled "to workspace" using just a variable-size signal?

1 view (last 30 days)
Rafael Cordero
Rafael Cordero on 17 Jul 2020
Answered: Rafael Cordero on 20 Jul 2020
Hello world!
I have a sequential signal processing model. It processes input biosignals in frames, and then outputs a series of outputs to the Matlab workspace.
One of these outputs is a variable-size signal created using a Matlab Function block.
I've been using enabled subsystems a lot because otherwise the various processing stages are performed even when there is no signal. I use the frames with the signal themselves as the enable signals. If they are non-zero: the processing block/stage is enabled.
Similarly, I wolud like to have an enabled 'To Workspace' subsystem so that only the meaningful outputs are passed to the workspace (and not a series of zeroes essentially). Normally this works fine. However, the enable doesnt like variable-size signals, so I cannot seem to output my variable-size signal with this enabled 'To Workspace' scheme. I have tried to get around this using "tricks" like compare-to-zero blocks, if statements, but these blocks also dont like variable-size signals.
Does anyone have any ideas or solutions?

Answers (1)

Rafael Cordero
Rafael Cordero on 20 Jul 2020
In the end I just used a selector to force the variable-size signal into a fixed-size (of length equal to the original variable-size signal).
Kinda weird though, I had to say the input had a dimensionality of 2 (even though its only 1) for it to work.

Community Treasure Hunt

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

Start Hunting!