0001 function [y,elev,wse] = ExtractMCS
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 zPathName = uigetdir('','Select the Directory Containing Processed Data Files (*.mat)');
0014 Files = dir(zPathName);
0015 allFiles = {Files.name};
0016 filefind=strfind(allFiles,'.mat')';
0017 filesidx=nan(size(filefind,1),1);
0018 for i=1:size(filefind,1)
0019 filesidx(i,1)=size(filefind{i},1);
0020 end
0021 filesidx=find(filesidx>0);
0022 files=allFiles(filesidx);
0023
0024
0025 selection = listdlg('ListSize',[300 300],'ListString', files,'Name','Select Data Files');
0026 zFileName = files(selection);
0027
0028
0029 if isa(zFileName,'cell')
0030 zf=size(zFileName,2);
0031 zFileName = sort(zFileName);
0032 else
0033 zf=1;
0034 zFileName={zFileName}
0035 end
0036
0037
0038 figure(1); clf
0039 clrs = colormap(jet(zf));
0040 for i = 1:zf
0041 wse(i)= input(['Water surface elevation (meters) for file ' zFileName{i} ' = ']);
0042 load([zPathName '\' zFileName{i}]);
0043
0044
0045
0046 binwidth = diff(V.mcsDist,1,2);
0047 binwidth = horzcat(binwidth(:,1), binwidth);
0048 binheight = diff(V.mcsDepth,1,1);
0049 binheight = vertcat(binheight, binheight(1,:));
0050 flux = nansum(nansum(V.u./100.*binwidth.*binheight));
0051
0052 if flux < 0;
0053 flipxs = 1;
0054 else
0055 flipxs = 0;
0056 end
0057 if ~flipxs
0058 y{i} = V.mcsDist(1,:);
0059 else
0060 y{i} = max(V.mcsDist(1,:)) - V.mcsDist(1,:);
0061 end
0062 elev{i} = wse(i) - V.mcsBed;
0063 plot(y{i},elev{i},'-','Color',clrs(i,:)); hold on
0064 end
0065
0066 xlabel('Distance (m)')
0067 ylabel('Elevation (m)')
0068 legend(zFileName,'Interpreter','none')