MATLAB: Change from set notation to dot notation

dot notationnum2cellplotsetxdataydata

Hi all,
Just in order to keep uniformity in my code, I would like to know if its possible to change the below expression from a 'set' notation to a dot notation.
Specifically, I have a plot were I am plotting a vector (x) with a matrix (y), hence I am getting multiple lines plotted at once. Obviously, where I desire to update the YData with my new matrix 'y1', i am unable to simply use the dot notation in the form seen below, since 'p' is consistent of 3 elements and 'y1' is a matrix:
% Plot of x & y data, where x is 1x100 and y is 3x100

p = plot(x,y) ;
% Update plot of x & y data with y1 vector, the same size as y

p.YData = y1 ;
%Error: Expected one output from a curly brace or dot indexing expression, but there were 3 results.
So the way which I found that works is:
% Plot of x & y data, where x is 1x100 and y is 3x100
p = plot(x,y) ;
% Update plot of x & y data with y1 vector, the same size as y
set(p, {'YData'}, num2cell(y1,2) )
% No Error
Hence, is there a way to represent the above with a dot notation?
Thanks for your help in advance,
KMT.

Best Answer

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."
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.