The MATLAB documentation explains that dot-notation only applies to scalar objects:
For non-scalar objects the documentation shows set (as you show in your question) or indexing (i.e. to reference a scalar object). This is also explained in the introduction to the new handle graphics: "Use the set and get functions to access properties for an array of objects."
https://www.mathworks.com/help/matlab/graphics_transition/graphics-handles-are-now-objects-not-doubles.html
So you could do something like this:
for k = 1:numel(p)
p(k).YData = y1(k,:);
end
or use set as you show in your question.
