-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvalidxy_mean.m
56 lines (50 loc) · 1.63 KB
/
validxy_mean.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
%% This function allows to take the mean of a couple of analyszed markers.
% Furthermore it allows you to take also the mean of the time. Every
% experimentalist knows the issue, vibrations. The only way of reducing the
% influence of vibrations which you have in your images is to take a mean
% value through time or images.
function [validx_mean,validy_mean,time_image_mean]=validxy_mean(validx,validy, time_image);
if exist('validx')==0
[validxname,Pathvalidx] = uigetfile('*.dat','Open validx.dat');
if validxname==0
disp('You did not select a file!')
return
end
cd(Pathvalidx);
validx=importdata(validxname,'\t');
end
if exist('validy')==0
[validyname,Pathvalidy] = uigetfile('*.dat','Open validy.dat');
if validyname==0
disp('You did not select a file!')
return
end
cd(Pathvalidy);
validy=importdata(validyname,'\t');
end
if exist('time_image')==0
[timename,Pathtime] = uigetfile('*.txt','Open time_image.txt');
if timename==0
time=0;
else
cd(Pathtime);
time_image=importdata(timename,'\t');
end
end
[nummarker numimages]=size(validx);
numaverage=3;
for j=1:numaverage
validxtemp(:,:,j)=validx(:,j:numaverage:(numimages-numaverage)+j);
validytemp(:,:,j)=validy(:,j:numaverage:(numimages-numaverage)+j);
if time~=0
time_image_temp(:,:,j)=time_image(j:numaverage:(numimages-numaverage+1)+j,:);
end
end
validx_mean=mean(validxtemp,3);
validy_mean=mean(validytemp,3);
save validx_mean.dat validx_mean
save validy_mean.dat validy_mean
if time~=0
time_image_mean=mean(time_image_temp,3);
save time_image.dat time_image
end