Set seed values for blocks with random number generators


oldseedstruct = se_setseeds(seedstruct)
oldseedstruct = se_setseeds(seedstruct,sysid)
[oldseedstruct, status] = se_setseeds(seedstruct)
[oldseedstruct, status] = se_setseeds(seedstruct,sysid)


se_setseeds(seedstruct) sets the seed parameter values for all SimEvents® blocks specified in seedstruct.

se_setseeds(seedstruct,sysid) applies the seed values to the system sysid, overriding the system specified in the system field of seedstruct.

oldseedstruct = se_setseeds(seedstruct) or oldseedstruct = se_setseeds(seedstruct,sysid)stores the original seed values in oldseedstruct before setting them to the values specified in seedstruct.

[oldseedstruct, status] = se_setseeds(seedstruct) or [oldseedstruct, status] = se_setseeds(seedstruct,sysid) returns status information indicating when the function does not set a seed.

Input Arguments


Structure having the same fields as the output of the se_getseeds function:

  • system — Value of the sysid input to se_getseeds

  • seeds — Structure array, of which each element has these fields:

    • block — Path name of a block that uses a random number generator, relative to system

    • value — Numeric seed value of the block


System name or subsystem path name.

Output Arguments


Structure representing original seed values. The form of oldseedstruct is the same as that of seedstruct.


Logical array whose nth entry is false if the nth block in seedstruct meets one of these conditions:

  • Does not exist

  • Is not a SimEvents block

  • Does not have a seed parameter in its current configuration

More About

collapse all


  • Before invoking this function, load or open the system where you want to set seeds.

Was this topic helpful?