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.

Respuestas (2)

Star Strider
Star Strider el 31 de Oct. de 2020
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 el 31 de Oct. de 2020
Editada: KSSV el 31 de Oct. de 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')

Productos

Versión

R2020a

Etiquetas

Preguntada:

el 31 de Oct. de 2020

Editada:

el 31 de Oct. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by