Isn't plotx a counter for the loop? You don't show enough to know for certain how you defined it, but if you've got that line in a loop it surely looks like that should be what it is...
The other answer to the question is that you don't really need to do anything special, though-- figure will create a new figure automagically with the figure handle of one greater than the highest existing figure at the time. You can save the array of figure handles if you want to access them programmatically, but their handles being integers are pretty easy to just refer to whether you've saved them explicitly or not--unless, of course, you're creating/deleting them sorta' willy-nilly, then you'd want to keep a list of valid handles updated.
What are you going to do w/ 30 figures at once, anyway, though?