Multi-channel timeseries signal with From Workspace block

조회 수: 10 (최근 30일)
I have a model which gets its input signals from the MATLAB workspace via the "From Workspace" block. My signal starts as an Mx2 array, that is, it is a two-channel sampled (discrete time) signal. The model buffers the input signals into frames using a "Buffer" block. All subsequent processing is frame-based, until the output, which unbuffers to produce an output signal at the same sample rate as the input signals.
However, when I use a timeseries object with multiple channels I get dimension errors in my model. I can fix that by changing "Treat Mx1 and unoriented sample-based signals as:" in the Buffer block from the recommended "One channel" to "M channels (this choice will be removed - see release notes)". Although it seems to work, I get this message:
Block 'Buffer' uses the frame status of the signal. Update your model to move control of sample-based and frame-based processing from the frame status of the signal to the block dialog parameters. For help in resolving this and other upgrade issues, run the 'Check model for block upgrade issues requiring compile time information' check in the Simulink Upgrade Advisor
How do I import a multi-channel signal into my model as a timeseries object without using the deprecated "Buffer" block option?

채택된 답변

MathWorks Support Team
MathWorks Support Team 2019년 4월 26일
There are multiple options for doing frame-based processing on multi-channel input signals. The attached model "multiChannelFrames.slx" demonstrates three different ways of accomplishing your desired behavior. The options are as follows:
1) Use a "From Workspace" and "Reshape" block to construct a multi-channel signal. Note that Simulink has different behavior for 1-D array signals (which are displayed with size N) and row vector signals (which are treated as 2-D arrays and displayed with size [1 N]). The "Buffer" block operates differently on these two types of signals. To get multi-channel behavior the input must be a 2-D array, i.e. have size [M N]. Therefore, we can use a "Reshape" block to force the signal to be a 2-D array with size [1 N]. The input to the "Buffer" block will then be a multi-channel signal at each time step.
2) Use a "Signal From Workspace" block. This block inherently handles the dimensionality concerns that were mentioned in Option 1. If the input signal has multiple columns, it will interpret each column as its own channel, as desired. We can then pass the multi-channel output of this block into the "Buffer" to create frames. However, this block does not support timeseries objects.
3) Use a "Signal From Workspace" block and specify the frame size in the 'Samples per frame' parameter. This is the similar to Option 2, but avoids the need for a "Buffer" block, since the block itself creates the frames. Note that this will behave slightly differently than the previous two options. Namely, the previous two options will lag one frame behind since they output all zero's for the first frame. You can see the difference in behavior by stepping through the example model.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Signal Generation에 대해 자세히 알아보기

제품


릴리스

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by