-1

What is the equivalent of the following for a C-mex s function? That is, how do I set discrete sample time of a block to the top level fixed step size in C?

My problem is, I could not find a way to "get" the top level fixed step size parameter in C-mex.

function setup(block)
  block.SampleTimes = [str2double(get_param(bdroot, 'FixedStep')) 0];

1 Answers1

1

Use ssGetFixedStepSize to get the base rate of the model. You may also want to ssSetErrorStatus if the that call returns 0, because that means your model is not configured with a FixedStep solver.

If, for some reason, you really want to go about fetching the information similar to what you have in the question, then you might be able to get access to it if you dig through the SimStruct pointer's fields. To do this, breakpoint in the mex file using a debugger and watch that variable.

Another option would be a few mexCallMATLAB calls to get the information you want.

Praetorian
  • 106,671
  • 19
  • 240
  • 328