I need to write a for loop so that my script analyses every 3rd column in my data

1 次查看(过去 30 天)
Hi,
Basically I have a huge amount of data, which I am writing a script for.
Essentially, i am trying to create 3 graphs per pH value at different wavelengths.
I have this so far:
Direc=dir("c:/Users/Documents") %determine directory
FileName=xlsread("Exp1FApHluorinTEST.xlsx") %determine file name
T=(0:8:1072);%vector of time from 0-1072 with 8 min interval
Dat=[];
Ave=[]
j=1;
[rows,cols]=size(FileName);
I have a data set which looks like this, I know it's a lot, sorry
Essentially, I want to create a graph, I know how to do this, but I do not know how to create a for/if loop to take all the information from 395nm for the entire dataset at each timepoint, and for each condition.
There are 135 readings for each wavelength, and essentially the conditions are tested in triplicate, so I have a rough code of what I used previously which is:
for i=1:cols;
if mod(i,2)==0;
Dat(:,j)=FileName(:,i);
j=j+1;
end
end
for j=1:(cols/2)
for i=1:(rows/3)
Ave(i,j)=mean([Dat((3*i-2),j) Dat((3*i-1),j) Dat((3*i),j) ]);
end
end
Though this is for a different data set where I required only the use of every other column, and then averaging of the 3 rows across that column, now I need every column.
If this makes sense, could someone please help me.
Thank you
  8 个评论
Fope Ayo
Fope Ayo 2019-6-2
Average by the Group, sorry this is easier to understand.
Plot the average data 395 for the first 3 which is AAA, then plot the average data at 395 for the next set of AAA, so essentially missing out the other groups - B, C and D on 8 different plots as the groups correspond to pH.
Sorry, I am not aware of what an abscissa is, probably the timestamp buried in the Time column.
dpb
dpb 2019-6-3
I got pulled away on farm activities (the cows have to drink), sorry... :)
So, to see if I got this, you're looking for 8 plots versus time with each of the four groups of three for a given group averaged over the repetitions?
Are the three wavelengths parameterized on each plot or are there then 8*3==>24 plots in total?

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

产品


版本

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by