The title of your question has nothing to do with the body of your question.
To answer your title:
To answer the body:
is indeed the correct syntax to plot B as y values and A as x values. If you get 2 lines in the legend, that would be because B has twice the numbers of rows or columns of A. If A and B are indeed both nx1, you cannot get two lines.