Creating a series of x-y plots
이전 댓글 표시
Hey, I want to make a set of x-y plots based on data with the following format:
"Tag Property-A Property-B
X1 A11 B11
X1 A12 B12
...........................
X2 A21 B21
..........................."
Properties A and B are the x and y variables. Each tag is matched with several pairs of A and B, and each plot should include data with a specific tag. Since there are a good many tags, it is impossible to manually separate the data. So is there any commands in Matlab that can be used to create such plots? I hope I have clearly stated my question. Thanks. Lin
P.S. I just realized the format couldn't display properly, so I'll briefly describe the data: there are three columns of data: Tag, Property A, Property B. Each tag encompasses a certain amount of x-y pairs, and the purpose is to make every one of the tags a plot showing the scattered x-y relationship.
A sample data file is attached.
댓글 수: 4
Chad Greene
2014년 9월 29일
Can you give an example of your data, so we can have some numbers and strings to play with?
Lin
2014년 9월 29일
Image Analyst
2014년 9월 29일
I fixed the formatting for you, but please read this http://www.mathworks.com/matlabcentral/answers/13205-tutorial-how-to-format-your-question-with-markup
Lin
2014년 9월 29일
채택된 답변
추가 답변 (1개)
Image Analyst
2014년 9월 29일
Just use readtable
t = readtable(xlsFullFileName);
Then extract the columns, use unique() to find unique tag names, then use logical indexing in a loop to extract rows for each tag in turn and plot. Let us know if you can't figure it out. Sorry, but I have to run off somewhere now.
댓글 수: 5
Chad Greene
2014년 9월 29일
Just a note, I think readtable requires version 2013b or later.
Lin
2014년 9월 29일
Image Analyst
2014년 9월 30일
If you have tags, like "X1", "X2", "ABC", "This stuff", "Tag 42", whatever, and some of them occur just once, and some of them multiple times, you can get a list of all the names, just listed once, with the unique() function.
uniqueNames = unique(tagList);
Once you have that you can get a list of all rows that have a particular tag, say "X1", like rows 1, 2, 14, 33, and 73 have tag "X1". Then you can get columns 2 and 3 for just those rows and do whatever you want with them.
Lin
2014년 10월 3일
Image Analyst
2014년 10월 3일
Use ismember().
카테고리
도움말 센터 및 File Exchange에서 Mathematics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
