By the way, learn to use semi-colons.
What happens here in MATLAB?
In B, MATLAB sees a matrix of size 8760X30. mean(B) computes the mean of all rows, which is a vector of size 1X30. It subtracts that vector from each row of B. (This is true only if you are using release R2016b or later of MATLAB. Earlier releases will fail if you write that.)
Then it multiplies the difference by the column vector of length 30 in P, a matrix*vector product. You might call it a dot product. So the result is a column vector, of length 8760.
Is that what you should be computing? If so, then MATLAB does exactly what you wanted, at least in that line. Of course, you may have intended something completely different. I cannot know what you really want to do, only what you write.
Next, I have no certainty what you intend by the line
Well, i can guess. Are you looking to square each element of A, putting the new vector into C? If so, then you need to write it as
Thus an element-wise squaring of the elements of A.