In the second loop, "a" is not sliced. This help text page describes the restrictions on sliced variables inside PARFOR - but basically the indexing expression for "a" must consist of 1 instance of the loop variable "i", and the remaining subscripts must be constants.
Also note that in the second example, "w" will be broadcast because it cannot be sliced - this means that the whole value of "w" will be sent to each worker; this can be inefficient.