bzr branch
http://suren.me/webbzr/normxcorr/trunk
1
by Suren A. Chilingaryan
Initial import |
1 |
clear all |
2 |
||
3 |
[daq,PathStress] = uigetfile('*.txt','Open data aquisition file'); |
|
4 |
cd(PathStress); |
|
5 |
import=importdata(daq,'\t'); |
|
6 |
clear daq |
|
7 |
if exist('import.data')==0 |
|
8 |
daq=import; |
|
9 |
else
|
|
10 |
daq=import.data; |
|
11 |
end
|
|
12 |
prompt = {'Which column is the experimental time?','Which column is the experimental stress?','Which column is the experimental temperature?'}; |
|
13 |
dlg_title = 'Please specify the matrix properties'; |
|
14 |
num_lines= 1; |
|
15 |
exptime = num2str(2); |
|
16 |
expstress = num2str(7); |
|
17 |
exptemp = num2str(10); |
|
18 |
def={exptime,expstress,exptemp}; |
|
19 |
answer = inputdlg(prompt,dlg_title,num_lines,def); |
|
20 |
exptime = str2num(cell2mat(answer(1,1))); |
|
21 |
expstress = str2num(cell2mat(answer(2,1))); |
|
22 |
exptemp = str2num(cell2mat(answer(3,1))); |
|
23 |
||
24 |
[Time_Image,PathImage] = uigetfile('*.txt','Open image-time file'); |
|
25 |
cd(PathImage); |
|
26 |
Time_Image=importdata(Time_Image,'\t'); |
|
27 |
Time_Image(:,2)=Time_Image(:,2)-Time_Image(1,2)+1; |
|
28 |
||
29 |
prompt = {'Time shift between data aquisition and image capture in [s]:'}; |
|
30 |
dlg_title = 'Please specify the onset of time'; |
|
31 |
num_lines= 1; |
|
32 |
timeshift = num2str(25); |
|
33 |
def={timeshift}; |
|
34 |
answer = inputdlg(prompt,dlg_title,num_lines,def); |
|
35 |
timeshift = str2num(cell2mat(answer(1,1))); |
|
36 |
||
37 |
[Resultsfile,PathResults] = uiputfile('stress_image_x.txt','Where do you want to save the results?'); |
|
38 |
||
39 |
[loopmean with]=size(daq); |
|
40 |
||
41 |
for i=5:(loopmean-5) |
|
42 |
time_stress(i,1)=mean(daq(i-4:i,exptime)); |
|
43 |
time_stress(i,2)=mean(daq(i-4:i,expstress)); |
|
44 |
% time_stress(i,3)=mean(daq(i-4:i,exptemp)); |
|
45 |
end
|
|
46 |
||
47 |
[loopimage widthtime]=size(Time_Image); |
|
48 |
for j=1:loopimage |
|
49 |
minpos=time_stress(:,1)-Time_Image(j,2)-timeshift; |
|
50 |
impos=find(abs(minpos)==min(abs(minpos))); |
|
51 |
image_stress(j,1)=j; |
|
52 |
image_stress(j,2)=mean(time_stress(impos,2)); |
|
53 |
% image_stress(j,3)=mean(time_stress(impos,3)); |
|
54 |
end
|
|
55 |
||
56 |
||
57 |
cd(PathResults); |
|
58 |
save stress_image_x.txt image_stress -ASCII |
|
59 |
plot(image_stress(:,1),image_stress(:,2)) |