Error: Simulink Scope Block does not support 'Array' format for logging matrix signals

조회 수: 41 (최근 30일)
I'm looking to log data from Simulink to the workspace as an array. I have two outputs as seen in the attached image, one is a 4x1 matrix and the other is a 2x1. I've reviewed the requirements for logging data as an array and I can't figure out what needs to change in my setup. The array outputs are 4 x 1 x t and 2 x 1 x t, where t is the size of the simulation time array. I want it to be a 2D array for each output, size 4 x t and 2 x t.
Currently I initialize each array using:
x_d = zeros(4,1);
u_d = zeros(2,1);
And then calculate the value of each element before sending the matrix on as the output signal.
I know one workaround would be just to send each individual element on as vectors and connecting each output to scope blocks. Or I think I could add in a block to change the dimensions of each signal.
Both ways seem inefficient so I'm sure there's another way in the initial setup I'm missing for the variable matrices.
Appreciate any help!

채택된 답변

Paul
Paul 2023년 3월 18일
편집: Paul 2023년 3월 18일
Why not use a To Workspace block?
If haven't done already this doc page is a good place to start to compare all options. In my experience, scopes are useful for looking at time traces, but not that useful for logging data for post-sim analysis. Of course, your mileage may vary.
  댓글 수: 2
John
John 2023년 3월 19일
Thanks Paul for the suggestion, I think I will use that in the future when trying to output data to the workspace! It doesn't quite resolve the issue as I still end up with a 3D output which is a bit of a hassle to access for my purposes. For example, the x_d variable its size is 4 x 1 x t, where t is the size of the simulation time array. My question wasn't quite clear I think, I've edited it for some clarity hopefully.
Ideally I'd like the output to be a 2-D array of size 4 x t, as that more accurately represents the real array that should be generated and is easier to access/view.
Thanks again!
Paul
Paul 2023년 3월 19일
If the input to the To Workspace is [4x1], you can insert a Signal Specification block onto the signal going in to the To Workspace. Set the 'Dimensions' parameter to 4 (or a variable that you know defines the long dimension of the signal). The To Workspace block will save the signal with 4 columns.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by