MATLAB: How to enter a value to a simulation while it is executing

MATLABsimulink

C=a+b; For a=1:1:1000, b=1:1:1000,I want to calculate C Value,,,I will be putting delay after calulating one addition and thereafter I want to give a flexibility to put his\her own 'a','b' value ,,,while code is executing,,,,Is it possible in MATLAB script?,,,if possible ,can anyone give me the hint to perform it

Best Answer

Assuming that the variables a and b correspond to tunable parameters of a block, you can indeed change the value of either variable in the MATLAB workspace and run set_param('modelname', 'SimulationCommand', 'update') to make the model notice the new values.
If 'a' and 'b' are signals, you may find this section in the documentation useful: Access Block Data During Simulation.