필터 지우기
필터 지우기

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

조회 수: 1 (최근 30일)
Fope Ayo
Fope Ayo 2019년 6월 2일
댓글: dpb 2019년 6월 3일
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