MATLAB Answers

How can I do a plot with correspondence tags in a legend automatically?

8 views (last 30 days)
Diego on 7 Mar 2014
I want to represent in a graphic four different tags. Concretely one antenna corresponding to 4 tags. My goal is that always the first plot can be the first tag, the second plot can be the second tag, the third plot can be the third tag and the fourth plot can be the fourth tag. I'm using a csv file.
If in the file there is one antenna with 4 tags the plot is very easy, but my problem is for example when in the file doesn't appear some tags, for example if in the file only appears the third tag and the fourth tag when I want to represent the plot the correspondence it is incorrect since the third and the fourth tag appears like the first and the second tag.
Another example if in the file only has the second tag it appears in the plot like the first tag but not as the second tag since in the file doesn't appear the one tag and it interprets that the second tag is the first second tag. I'm using legend property of Matlab (in the plot) for making this. I can do this If I modify the legend but I want to do these automatically.
hleg1 = legend(tag2); set(hleg1,'Location','Best')
So my goal is that always independently the tags that appears in the file, the correspondence will be correct as I said before.
I attach the file. Thanks in advance!


Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!