simulink - Level1 Matlab S-function - "Work Vectors" -


i'm using matlab level 1 s-function several times in model don't want mutual overwriting of global/persistent variables.

a solution work vectors there little documentation level 1 s-function work vectors. simstruct s sssetnumrwork function?

thanks!

the right thing upgrade code level-2 s-function, shouldn't difficult.

level 1 m-code s-functions don't have work vectors (and of ssget/set functions c-code s-functions anyway). reason aren't recommended more have limited functionality -- there's no nice way of getting around without using level 2 functionality.

you can use persistent variables (within each subfunction of level-1 s-function). point of global variables enable them seen everywhere, trying use them without wanting see them seems pointless. (note: should never use global variables anyway.)

having said that, if want use level-1 functionality, within each s-function can use getappdata , setappdata functions act work vector storage. if you're going go trouble, upgrading level-2 s-function easier anyway.


Comments