The z axis is the 3rd dimension but your plot is 2D.
You yyaxis to assign an independent label to the right y-axis. Then link the two yaxes so that if properties of one change, the other axis will remain identical.
Demo:
yyaxis(app.UIAxes, 'right')
ylabel(app.UIAxes, 'Right Side Label')
set(app.UIAxes.YAxis, 'Color', app.UIAxes.XAxis.Color)
yyaxis(app.UIAxes, 'left')
ylabel(app.UIAxes, 'Left Side Label')
plot(app.UIAxes, randi(100,1,20), randi(50, 1,20), 'o')
app.UIAxes.UserData = linkprop(app.UIAxes.YAxis,...
{'Limits','LimitsMode','TickValues','TickLabelFormat','Scale',...
Result:
Best Answer