Plotting a graph for each group/category in a table

I have results similar to the data attached, and I am looking to get individual plots of the average measurement (MA) against day (Day) for each set of tests (Test_ID) and then fit a curve to the graph produced. I am able to do this individually by calling the specific Test_ID, but would like to do this for all test sets at once (producing a different figure for each one). I thought a for loop might work, but the Test_ID isn't purely numeric, and the Day totals for each test (in the sample they're all 10) in my actual data are not always going to be identical.
nice and new to using MATLAB, so I've found the tables feature super helpful as a way to think about my data, but now a little out of my depth.

 채택된 답변

KSSV
KSSV 2020년 10월 6일

1 개 추천

Read about gscatter.

댓글 수: 4

from what I can see this would then plot each set of tests on the same graph with diffrent colours to denote each set. Is it possible to plot each set of tests on seperate figures, as I am then looking to perform curve fits on each set?
KSSV
KSSV 2020년 10월 6일
편집: KSSV 2020년 10월 6일
Yes very much possible.....If A is your data matrix, with one column say second one has group.
G = A(:,2) ; % groups
[C,ia,ib] = unique(G) ;
N = length(C) ;
for i = 1:N
% Extract each group data
Ai = A(ib==i,:)
end
Thank you, that helped immensely
Thanks is accepting/ voting the answer.. :)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

질문:

2020년 10월 6일

댓글:

2020년 10월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by