To set the solver type for a specific block to "Fixed-step," you are on the right track with the following code:
set_param(myModel, 'SolverType', 'Fixed-step');
However, for discrete blocks, you typically don't need to specify a solver type as you would for continuous blocks. Instead, you define the sample time for the block.
If you want to set a sample time for a specific block to make it discrete, you can use the set_param function as follows:
blockName = 'YourBlockName';
set_param([myModel '/' blockName], 'SampleTime', sampleTime);
Replace 'YourBlockName' with the name of the block for which you want to set the sample time. This will configure the block as a discrete block with the specified sample time.
Please make sure that 'discrete' is a valid option for the specific block in your Simulink model and that you are using the correct block name in the set_param function.
---------------------------------------------------------------------------------------------------------------------------------------------------
If you find the solution helpful and it resolves your issue, it would be greatly appreciated if you could accept the answer. Also, leaving an upvote and a comment are also wonderful ways to provide feedback.
Professional Interests
- Technical Services and Consulting
- Embedded Systems | Firmware Developement | Simulations
- Electrical and Electronics Engineering
Feel free to contact me.