forked from ldominguezruben/meanderstatisticstoolbox
-
Notifications
You must be signed in to change notification settings - Fork 2
/
mStat_myupdatefcn.m
61 lines (53 loc) · 2.08 KB
/
mStat_myupdatefcn.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
57
58
59
60
61
function txt = mStat_myupdatefcn(obj,event_obj)
%
%Read input variables
bendID= getappdata(0, 'bendID');
bendID = str2num(bendID);
sinuosityOfBends = getappdata(0, 'sinuosityOfBends');
sinuosityOfBends = str2num(sinuosityOfBends);
lengthCurved = getappdata(0, 'lengthCurved');
lengthCurved = str2num(lengthCurved);
wavelengthOfBends = getappdata(0, 'wavelengthOfBends');
wavelengthOfBends = str2num(wavelengthOfBends);
amplitudeOfBends = getappdata(0, 'amplitudeOfBends');
amplitudeOfBends = str2num(amplitudeOfBends);
intS = getappdata(0, 'intS');
intS = str2num(intS);
downstreamSlength = getappdata(0, 'downstreamSlength');
downstreamSlength = str2num(downstreamSlength);
upstreamSlength = getappdata(0, 'upstreamSlength');
upstreamSlength = str2num(upstreamSlength);
sResample = getappdata(0, 'sResample');
sResample = str2num(sResample);
equallySpacedX= getappdata(0, 'equallySpacedX');
equallySpacedX = str2num(equallySpacedX);
equallySpacedY = getappdata(0, 'equallySpacedY');
equallySpacedY = str2num(equallySpacedY);
newInflectionPts = getappdata(0, 'newInflectionPts');
newInflectionPts = str2num(newInflectionPts);
%data window
pos = get(event_obj,'Position');
clickX=round(pos(1)*10000)/10000;
clickY=round(pos(2)*10000)/10000;
%create vector
cursorX=nan(length(bendID),500);
cursorY=nan(length(bendID),500);
for hf=1:length(bendID)
[highlightX, highlightY] = userSelectBend(intS, bendID (hf),...
equallySpacedX,equallySpacedY,newInflectionPts,...
sResample);
len=length(highlightX);
cursorX(hf,1:len)=highlightX;
cursorY(hf,1:len)=highlightY;
end
%find equal
[row,~]= find(clickX==cursorX);
pos = get(event_obj,'Position');
txt = {['BendID: ',num2str(row)],['Sinuosity: ',num2str(round(sinuosityOfBends(row),2))],...
['Arc Wavelength [m]: ',num2str(round(lengthCurved(row),1))],...
['Wavelength [m]: ',num2str(round(wavelengthOfBends(row),1))],...
['Amplitude [m]: ',num2str(round(amplitudeOfBends(row),1))],...
['Upstream length [m]: ',num2str(round(upstreamSlength(row),1))],...
['Downstream length [m]: ',num2str(round(downstreamSlength(row),1))]};
set(0,'userdata',pos);
end