The labelPlot function takes a 1-by-3 string array and uses the elements to label the x- and y-axes and add a title. The function does not allow missing array elements.
function labelPlot(labels)
arguments
labels (1,3) string {mustBeNonmissing}end
xlabel(labels(1))
ylabel(labels(2))
title(labels(3))
end
Create a plot and use the labelPlot function to add labels and a title. The function input array contains a missing element so the mustBeNonmissing function throws an error.