There are some limitation to use structures through the FromWorkspace block:
A MATLAB expression that evaluates to one of the following:
- A MATLAB timeseries object
- A structure of MATLAB timeseries objects
- A two-dimensional matrix:
The first element of each matrix row is a time stamp.
The rest of each row is a scalar or vector of signal values.
- A structure, with or without time, which contains:
1) A signals.values field, which contains a vector of signal values
2) An optional signals.dimensions array, which contains the dimensions of the signal
3) An optional time vector, which contains time stamps
More useful information you can find in help.
So in your case you can use different methods. I'll give some examples:
1) define your struct
in necessary format:
t = (1:10)'; %'
v = [6 9 3 1 7 0 7 3 8 1]'; %'
measure.time = t;
measure.signals.values = v;
Important moment here: t
andv
must be a columns! rows will not work!
If you need to use several rows of data use multidimensional v
and add
measure.signals.dimentions = size(v,2);
2) You can see ths time
field is an optional. If you do not have it you need to set Sample time in block other than 0 and, clear Interpolate Data, Set Form output after final data value by to a value other than Extrapolation. Furthermore, you need to define time field:
mystruct.time = [];
3) If you don't want to change your structure, you can use next:
t = (1:10)'; %'
and set this in Data of FromWorkspace block: [t, Measurements.B_cal.value]
.
4) There are some useful methods: use timeseries or just matrix. But it's not really your case if you need to use your structure.
Measurements.B_cal
– Daniel