Variable definition

is it correct to do like that?
variable p(5,1)
for i=1:5
obj=obj+p(i)*p(i)
end
minimize (obj)