Mohammad - the line of code
legend('sin','cos','Location','North','Box','off')
seems to be considering the final two inputs/strings as labels for curves that don't exist. If you just execute the command
h = legend('sin','cos','Location','North')
it works without warning, and moves the legend to the appropriate location.
Glancing at the documentation for legend, there doesn't seem to be an option that allows you to set the curve labels and the box in this manner. There are "signatures" for Location and for Orientation, but when it comes to using the other parameters, the one signature seems to be just legend(strings,Name,Value)
So if you were to try
legend({'sin','cos'},'Box','off')
then no warning would be generated, but on my version of MATLAB (R2013a), only part of the box is removed. In order to remove all of the box, I either have to do
h = legend('sin','cos','Location','north');
set(h,'boxoff');
or
h = legend('sin','cos','Location','north');
set(h,'box','off');
Best Answer