Search code examples
matlabsimulationcircuit

Get the result of sim in matlab code with input parameter returns not found


I have this circuit in Matlab simulation

enter image description here

As you can see I have R7 variable in my picture .

I want to run this simulink using Matlab script as you can see here :

simOut = sim('ehsaaan.slx','R7','1e-100')

As you can see I pass R7 to my circuit. But when I run the code I get this error :

Error using main
block_diagram does not have a parameter named 'R7'

Solution

  • SimScape parameters maynot be acessible as sim name-valus pairs. You can use set_param to set the resistance parameter R as follows:

    set_param('ehsaaan/R7','R','1e-100')
    simOut = sim('ehsaaan.slx')