0

I have written a S-Function in MATLAB. Now I want to pass a Matrix into the input via the 'simin' Source. I have initialized the time of the simin variable with simin.time = 0 and the values are stored in a dynamically sized matrix. So for example simin.signals.values = ones(4). Now MATLAB tells me that 'time and data values must have the same number of rows'. I understand that but how can I pass a matrix in one timestep? And is it possible to simulate a S-Function only once and not cyclic?

Tester123
  • 15
  • 5

1 Answers1

1

You'll need to specify the dimensions of the signal, see the documentation

Matlab Docs

I've done a simple test, simulate for 10 seconds and it all looks good.

simin.time = 0;
simin.signals.values = ones(4)
simin.signals.dimensions = [4,4];

Simple Model

macduff
  • 4,655
  • 18
  • 29