MATLAB: Legend

urgent

I have a matrix m which varies with vectors a and b. I've plotted m versus a for different values of b, but I don't know how to set the legend command corresponding different values for b. I will be so grateful if somebody can help me.

Best Answer

Try
  • if b is a numerical vector with:
legend(num2str(b(:)))
  • If b is a string vector :
legend(b)
Related Question