Scatterplot from .mat file data with loop

How do I make a scatter plot from a .mat file that looks like this?
I have a .mat file with data from 15 petri dish colonies. Each column has 10 days of population data. There are 15 rows. I need each dish to plot its points vertically and then draw a line with thickness 3 that is the average of the days. I have been told to use a loop but I'm completely stuck on even starting.

Answers (2)

Try something like this:
Colonies = rand(15,10); %Days = 15, Colonies = 10
MeanColonies = mean(Colonies,2);
Days = 1:15;
figure
plot(Days, Colonies, 'p')
hold on
plot(Days, MeanColonies, 'LineWidth',2)
hold off
.
KSSV
KSSV on 31 Oct 2020
Edited: KSSV on 31 Oct 2020
A = rand(15,8) ; % random data for demo
[m,n] = size(A) ;
% Get mean
M = mean(A) ;
X = repmat(1:n,m,1) ;
scatter(X(:),A(:),[],A(:))
hold on
plot(1:n,M,'k')

Products

Release

R2020a

Asked:

on 31 Oct 2020

Edited:

on 31 Oct 2020

Community Treasure Hunt

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

Start Hunting!