-
Notifications
You must be signed in to change notification settings - Fork 5
/
mStat_StatisticsVariables.m
117 lines (87 loc) · 3.96 KB
/
mStat_StatisticsVariables.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
function varargout = mStat_StatisticsVariables(varargin)
% MSTAT
% Statistics variables tools
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @mStat_StatisticsVariables_OpeningFcn, ...
'gui_OutputFcn', @mStat_StatisticsVariables_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
% If ERROR, write a txt file with the error dump info
% try
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% --- Executes just before mStat_StatisticsVariables is made visible.
function mStat_StatisticsVariables_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
hwait = waitbar(0,'River statistics...','Name','MSTaT tool',...
'CreateCancelBtn',...
'setappdata(gcbf,''canceling'',1)');
setappdata(hwait,'canceling',0);
% Choose default command line output for mStat_StatisticsVariables
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
set(handles.figure1,'Name',['MStaT: Statistic Variables '], ...
'DockControls','off')
matrixOfBendStatistics = [num2cell([varargin{1}.bendID1' round(varargin{1}.sinuosityOfBends,2) ...
round(varargin{1}.lengthCurved',2) round(varargin{1}.wavelengthOfBends,2) round(varargin{1}.amplitudeOfBends,2)])...
varargin{1}.condition num2cell([round(varargin{1}.upstreamSlength',2) round(varargin{1}.downstreamSlength',2)])];
waitbar(0.5,hwait);
long=numel(matrixOfBendStatistics);
fila=long/8;
matrixOfBendStatistics=reshape(matrixOfBendStatistics,fila,8);
handles.matrixOfBendStatistics = matrixOfBendStatistics;
set(handles.riverStats, 'data', handles.matrixOfBendStatistics)
guidata(hObject, handles);
uiresume(gcbf);
waitbar(1,hwait);
delete(hwait)
% --- Outputs from this function are returned to the command line.
function varargout = mStat_StatisticsVariables_OutputFcn(hObject, eventdata, handles)
varargout{1} = handles.output;
% --- Executes when entered data in editable cell(s) in riverStats.
function riverStats_CellEditCallback(hObject, eventdata, handles)
% Empty
% --- Executes when selected cell(s) is changed in riverStats.
function riverStats_CellSelectionCallback(hObject, eventdata, handles)
% Empty
% --- Executes during object deletion, before destroying properties.
function riverStats_DeleteFcn(hObject, eventdata, handles)
% Empty
% --- Executes during object creation, after setting all properties.
function riverStats_CreateFcn(hObject, eventdata, handles)
% Empty
% --- Executes on button press in closeTertiaryWindow.
function closeTertiaryWindow_Callback(hObject, eventdata, handles)
clear all;
% --- Executes during object creation, after setting all properties.
function closeTertiaryWindow_CreateFcn(hObject, eventdata, handles)
% empty
% --- Executes during object deletion, before destroying properties.
function closeTertiaryWindow_DeleteFcn(hObject, eventdata, handles)
% empty
% --- Executes during object deletion, before destroying properties.
function saveAsTxt_DeleteFcn(hObject, eventdata, handles)
% empty
% --------------------------------------------------------------------
function export_Callback(hObject, eventdata, handles)
% empty
% --------------------------------------------------------------------
function exportxlsx_Callback(hObject, eventdata, handles)
%Create table with data
tabledata = get(handles.riverStats,'data');
headers = {'Bend ID' 'Sinuosity_[m]' 'Arc_Wavelength_[m]' 'Wavelength_[m]'...
'Amplitude[m]' 'Condition' 'Upstream_Length[m]' 'Downstream_Length[m]'};
pvout = vertcat(headers,tabledata);
[file,path] = uiputfile('*.xlsx','Save file');
xlswrite([path file], pvout);
warndlg('Export succesfully!!')