tp@0: function edpathsfile = EDB1findpathsISESx(eddatafile,lengthNspecmatrix,lengthNdiffmatrix,... tp@0: singlediffcol,startindicessinglediff,endindicessinglediff,... tp@0: ndecimaldivider,PointertoIRcombs,IRoriginsfrom,S,R,isou,irec,... tp@0: directsound,specorder,difforder,nedgesubs,visplanesfromS,visplanesfromR,... tp@0: vispartedgesfromS,vispartedgesfromR,desiredfilename) tp@0: % EDB1findpathsISESx - Finds all possible paths that include direct sound, specular, diffraction. tp@0: % Finds all possible paths of types direct sound, specular, diffraction tp@0: % combinations of specular and diffraction. tp@0: % tp@0: % Input parameters: tp@0: % eddatafile Taken directly from the setup-file or created automatically tp@0: % lengthNspecmatrix, lengthNdiffmatrix tp@0: % singlediffcol, startindicessinglediff, endindicessinglediff tp@0: % ndecimaldivider, PointertoIRcombs, IRoriginsfrom tp@0: % Taken directly from the ISEStree-file tp@0: % S, R, isou, irec Coordinates and counter number of source and receiver, taken tp@0: % from the setup file. tp@0: % directsound, specorder, difforder tp@0: % Taken directly from the setup-file. tp@0: % nedgesubs Taken directly from the setup-file. tp@0: % visplanesfromS, visplanesfromR, vispartedgesfromS, vispartedgesfromR tp@0: % Taken directly from the srdatafile. tp@0: % desiredfilename (optional) The desired name of the output file. tp@0: % ISCOORDS (global) The matrix ISCOORDS from the ISEStreefile tp@0: % POTENTIALISES (global) The matrix POTENTIALISES from the ISEStreefile tp@0: % ORIGINSFROM (global) tp@0: % ISESVISIBILITY (global) tp@0: % IVNDIFFMATRIX (global) The list IVNDIFFMATRIX from the ISEStreefile tp@0: % IVNSPECMATRIX (global) tp@0: % REFLORDER (global) tp@0: % tp@0: % See descriptions in EDB1findISEStree, EDB1srgeo and EDB1mainISES tp@0: % tp@0: % Output parameters: tp@0: % edpathsfile The output file name, where the output data is tp@0: % stored. If the optional input parameter desiredfilename, tp@0: % is given, then edpathsfile will simple repeat tp@0: % this name. If desiredfilename was not specified tp@0: % a file name is created by extracting the file tp@0: % stem from the input parameter eddatafile, and tp@0: % with '_edpaths' added. tp@0: % tp@0: % Output data in the edpathsfile: tp@0: % pathtypevec A matrix, [ncombs,specorder], describing the tp@0: % type of reflection, using 'f' for the direct tp@0: % sound, 's' for specular reflection and 'd' for tp@0: % diffraction. tp@0: % reflpaths A matrix, [ncombs,specorder], giving the plane tp@0: % and edge numbers involved in each refl. comb. tp@0: % specextradata A sparse matrix, [ncombs,(specorder+1)*3] tp@0: % containing the coordinates of the image source tp@0: % (col 1-3), the image receiver (col 4-6) tp@0: % and the coordinates of all specular hit points tp@0: % (only for purely specular combinations). tp@0: % edgeextradata A sparse matrix, [ncombs,(specorder*2)], with tp@0: % the visibility of the involved edge, denoted tp@0: % by two values between 0 and 1. tp@0: % S The coordinates of the source. tp@0: % R The coordinates of the receiver. tp@0: % mainlistguide A matrix, [nposscombs,3], which for each row gives tp@0: % 1. the number of rows in "reflpaths" and tp@0: % "pathtypevec" that have one type of combination. tp@0: % 2. the first row and 3. the last row tp@0: % mainlistguidepattern A matrix, [nposscombs,specorder] which for each tp@0: % row gives the description of each possible combination tp@0: % using 'f', 's' and 'd'. tp@0: % directsoundrow The value 0 or 1 indicating whether the first row in tp@0: % mainlistguide & mainlistguidepattern & reflpaths & pathtypevec tp@0: % contains the direct sound or not. tp@0: % allspecrows A list, [1,2], containing the first and last row numbers tp@0: % of mainlistguide & mainlistguidepattern that contain specular tp@0: % reflections. If there are no specular reflections, allspecrows tp@0: % contains [0 0]. tp@0: % firstdiffrow A number indicating which is the first row of mainlistguide & tp@0: % mainlistguidepattern that contain a diffraction component. If tp@0: % there are no diffraction components, firstdiffrow = 0. tp@0: % Sinsideplanenumber The plane number that the source is directly at. If the tp@0: % source is not placed directly at a plane, then tp@0: % souinsideplanenumber = []; tp@0: % Rinsideplanenumber The plane number that the receiver is directly at. If the tp@0: % receiver is not placed directly at a plane, then tp@0: % recinsideplanenumber = []; tp@0: % tp@0: % Uses the functions EDB1strpend EDB1directsound tp@0: % EDB1speculISES EDB1diffISESx EDB1diff2ISES EDB1diffNISES tp@0: % tp@0: % ---------------------------------------------------------------------------------------------- tp@0: % This file is part of the Edge Diffraction Toolbox by Peter Svensson. tp@0: % tp@0: % The Edge Diffraction Toolbox is free software: you can redistribute it and/or modify tp@0: % it under the terms of the GNU General Public License as published by the Free Software tp@0: % Foundation, either version 3 of the License, or (at your option) any later version. tp@0: % tp@0: % The Edge Diffraction Toolbox is distributed in the hope that it will be useful, tp@0: % but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS tp@0: % FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. tp@0: % tp@0: % You should have received a copy of the GNU General Public License along with the tp@0: % Edge Diffraction Toolbox. If not, see . tp@0: % ---------------------------------------------------------------------------------------------- tp@0: % Peter Svensson (svensson@iet.ntnu.no) 20050404 tp@0: % tp@0: % edpathsfile = EDB1findpathsISES(eddatafile,... tp@0: % lengthNspecmatrix,lengthNdiffmatrix,singlediffcol,startindicessinglediff,... tp@0: % endindicessinglediff,ndecimaldivider,PointertoIRcombs,IRoriginsfrom,S,R,isou,irec,... tp@0: % directsound,specorder,difforder,nedgesubs,visplanesfromS,visplanesfromR,... tp@0: % vispartedgesfromS,vispartedgesfromR,desiredfilename); tp@0: tp@0: global SHOWTEXT tp@0: global POTENTIALISES ISCOORDS IVNDIFFMATRIX tp@0: global IVNSPECMATRIX ORIGINSFROM ISESVISIBILITY REFLORDER tp@0: tp@0: eval(['load ',eddatafile]) tp@0: clear cornerinfrontofplane edgeseesplane planeseesplane tp@0: tp@0: if nargin < 22 tp@0: [filepath,filestem,fileext] = fileparts(eddatafile); tp@0: edpathsfile = [[filepath,filesep],EDB1strpend(filestem,'_eddata'),'_',int2str(isou),'_',int2str(irec),'_edpaths.mat']; tp@0: else tp@0: edpathsfile = desiredfilename; tp@0: end tp@0: tp@0: nplanes = length(planeisthin); tp@0: tp@0: pathtypevec = []; tp@0: reflpaths = []; tp@0: specextradata = []; tp@0: edgeextradata = []; tp@0: mainlistguide = []; tp@0: mainlistguidepattern = []; tp@0: tp@0: %------------------------------------------------------- tp@0: % ############################# tp@0: % ## DIRECT SOUND ## tp@0: % ############################# tp@0: tp@0: if directsound == 1 tp@0: if SHOWTEXT >= 2 tp@0: disp(' Direct sound') tp@0: end tp@0: dirsoundok = EDB1directsound(eddatafile,S,R,visplanesfromS,visplanesfromR); tp@0: if dirsoundok == 1 tp@0: pathtypevec = [pathtypevec;['f',zeros(1,specorder-1)]]; tp@0: reflpaths = [reflpaths;zeros(1,specorder)]; tp@0: if specorder > 0 tp@0: specextradata = [specextradata;[S R zeros(1,(specorder-1)*3)]]; tp@0: else tp@0: specextradata = [specextradata;[S R]]; tp@0: end tp@0: edgeextradata = [edgeextradata;zeros(1,specorder*2)]; tp@0: mainlistguide = [1 1 1]; tp@0: mainlistguidepattern = ['f' ' '*ones(1,specorder-1)]; tp@0: directsoundrow = 1; tp@0: else tp@0: directsoundrow = 0; tp@0: end tp@0: else tp@0: directsoundrow = 0; tp@0: end tp@0: tp@0: %------------------------------------------------------- tp@0: % ############################# tp@0: % ## SPECULAR ## tp@0: % ############################# tp@0: tp@0: if specorder >= 1 tp@0: if SHOWTEXT >= 2 tp@0: disp(' SPECULAR reflections') tp@0: end tp@0: [validISlist,validIScoords,allreflpoints,listguide,listofreflorder] = EDB1speculISES(eddatafile,... tp@0: S,R,lengthNspecmatrix,specorder,visplanesfromR); tp@0: [nvalidreflorders,slask] = size(listguide); tp@0: for ii = 1:nvalidreflorders tp@0: ncombs = listguide(ii,1); tp@0: norder = listofreflorder(ii); tp@0: tp@0: if ncombs > 0 tp@0: pathtypevec = [pathtypevec;['s'*ones(ncombs,norder) zeros(ncombs,specorder-norder)]]; tp@0: reflpaths = [reflpaths;validISlist(listguide(ii,2):listguide(ii,3),:)]; tp@0: if size(pathtypevec,2) > size(reflpaths,2) tp@0: reflpaths = [reflpaths zeros(size(reflpaths,1),size(pathtypevec,2)-size(reflpaths,2))]; tp@0: end tp@0: specextradata = [specextradata;[validIScoords(listguide(ii,2):listguide(ii,3),1:3) allreflpoints(listguide(ii,2):listguide(ii,3),:)]]; tp@0: if size(specextradata,2) < (size(pathtypevec,2)+1)*3 tp@0: specextradata = [specextradata zeros(size(specextradata,1),(size(pathtypevec,2)+1)*3-size(specextradata,2))]; tp@0: end tp@0: edgeextradata = [edgeextradata;zeros(ncombs,specorder*2)]; tp@0: end tp@0: tp@0: mainlistguidepattern = [mainlistguidepattern;['s'*ones(1,norder) ' '*ones(1,specorder-norder)]]; tp@0: tp@0: end tp@0: tp@0: [nprevious,slask] = size(mainlistguide); tp@0: if nprevious > 0 tp@0: listguide(:,2:3) = listguide(:,2:3)+mainlistguide(nprevious,3); tp@0: end tp@0: mainlistguide = [mainlistguide;listguide]; tp@0: if nvalidreflorders == 0 tp@0: allspecrows = [0 0]; tp@0: else tp@0: allspecrows = [min([1 nvalidreflorders]) nvalidreflorders]+directsoundrow; tp@0: end tp@0: firstdiffrow = nvalidreflorders + directsoundrow + 1; tp@0: tp@0: else tp@0: allspecrows = [0 0]; tp@0: firstdiffrow = directsoundrow + 1; tp@0: end tp@0: tp@0: %------------------------------------------------------- tp@0: % #################################### tp@0: % ## SINGLE DIFFRACTION ## tp@0: % #################################### tp@0: tp@0: if difforder >=1 & ~isempty(lengthNdiffmatrix) tp@0: if SHOWTEXT >= 2 tp@0: disp(' SINGLE DIFFRACTION combined with any order specular') tp@0: end tp@0: [edgedifflist,startandendpoints,prespeclist,postspeclist,validISEDcoords,validEDIRcoords,listguide,listoforders,... tp@0: bigedgeweightlist] = EDB1diffISESx(eddatafile,S,R,... tp@0: IVNDIFFMATRIX(1:lengthNdiffmatrix(1),1),singlediffcol,startindicessinglediff,endindicessinglediff,... tp@0: specorder,visplanesfromR,vispartedgesfromS,vispartedgesfromR,nedgesubs,ndecimaldivider,PointertoIRcombs,IRoriginsfrom); tp@0: [nvalidcombs,slask] = size(listguide); tp@0: nprespecs = listoforders(:,2) - 1; tp@0: npostspecs = listoforders(:,1) - nprespecs - 1; tp@0: tp@0: [nrows,nsubsegmentcols] = size(startandendpoints); tp@0: nsubsegments = uint8( (startandendpoints(:,2:2:nsubsegmentcols))~=0 ); tp@0: tp@0: if nrows > 1 & nsubsegmentcols > 2 tp@0: nsubsegments = sum(nsubsegments.').'; tp@0: end tp@0: nmaxsubsegments = max(nsubsegments); tp@0: tp@0: expandedlistguide = listguide; tp@0: for ii = 1:nvalidcombs tp@0: ncombs = listguide(ii,1); tp@0: iv = [listguide(ii,2):listguide(ii,3)]; tp@0: tp@0: pathtypevec = [pathtypevec; ['s'*ones(ncombs,nprespecs(ii)) 'd'*ones(ncombs,1) 's'*ones(ncombs,npostspecs(ii)) zeros(ncombs,specorder-listoforders(ii)) ]]; tp@0: reflpaths = [reflpaths; [prespeclist(iv,1:nprespecs(ii)) edgedifflist(iv) postspeclist(iv,1:npostspecs(ii)) zeros(ncombs,specorder-listoforders(ii)) ]]; tp@0: specextradata = [specextradata;[ validISEDcoords(iv,1:3) validEDIRcoords(iv,1:3) zeros(ncombs,(specorder-1)*3) ]]; tp@0: edgeextradata = [edgeextradata;[startandendpoints(iv,1:2) zeros(ncombs,(specorder-1)*2) ]]; tp@0: mainlistguidepattern = [mainlistguidepattern;['s'*ones(1,nprespecs(ii)) 'd' 's'*ones(1,npostspecs(ii)) zeros(1,specorder-listoforders(ii))]]; tp@0: if nmaxsubsegments > 2 tp@0: for jj = 2:nmaxsubsegments tp@0: ivsub = find(nsubsegments(iv)>=jj); tp@0: ncombssubset = length(ivsub); tp@0: if ncombssubset > 0 tp@0: pathtypevec = [pathtypevec; ['s'*ones(ncombssubset,nprespecs(ii)) 'd'*ones(ncombssubset,1) 's'*ones(ncombssubset,npostspecs(ii)) zeros(ncombssubset,specorder-listoforders(ii)) ]]; tp@0: reflpaths = [reflpaths; [prespeclist(iv(ivsub),1:nprespecs(ii)) edgedifflist(iv(ivsub)) postspeclist(iv(ivsub),1:npostspecs(ii)) zeros(ncombssubset,specorder-listoforders(ii)) ]]; tp@0: specextradata = [specextradata;[ validISEDcoords(iv(ivsub),1:3) validEDIRcoords(iv(ivsub),1:3) zeros(ncombssubset,(specorder-1)*3) ]]; tp@0: edgeextradata = [edgeextradata;[startandendpoints(iv(ivsub),(jj-1)*2+1:(jj-1)*2+2) zeros(ncombssubset,(specorder-1)*2) ]]; tp@0: expandedlistguide(ii,1) = expandedlistguide(ii,1) + ncombssubset; tp@0: expandedlistguide(ii,3) = expandedlistguide(ii,3) + ncombssubset; tp@0: for kk = ii+1:nvalidcombs tp@0: expandedlistguide(kk,2:3) = expandedlistguide(kk,2:3) + ncombssubset; tp@0: end tp@0: end tp@0: end tp@0: end tp@0: end tp@0: [n1,n2] = size(mainlistguide); tp@0: if n1 > 0 tp@0: listoffset = mainlistguide(n1,3); tp@0: else tp@0: listoffset = 0; tp@0: end tp@0: if size(expandedlistguide,1) > 0 tp@0: mainlistguide = [mainlistguide;[expandedlistguide(:,1) expandedlistguide(:,2:3)+listoffset]]; tp@0: end tp@0: end tp@0: tp@0: %------------------------------------------------------- tp@0: % ################################################ tp@0: % ## DOUBLE AND HIGHER DIFFRACTION ## tp@0: % ################################################ tp@0: tp@0: for kk = 2:min([specorder difforder]) tp@0: tp@0: if ~isempty(lengthNdiffmatrix) tp@0: tp@0: if SHOWTEXT >= 2 tp@0: disp([' DIFFRACTION, ORDER ',int2str(kk),' combined with any order specular']) tp@0: end tp@0: tp@0: nmaxsubsegments = 0; tp@0: tp@0: % We will use the spec-edge-spec combs that were found valid for tp@0: % first-order diffraction, because if higher-order diffraction combs tp@0: % end with the same edge-spec-spec-... comb we know the visibility tp@0: % already. tp@0: % First, pick out only the combs that have postspecs. Second, keep tp@0: % only a unique set because there will be many repeated combinations. tp@0: tp@0: tp@0: if kk == 2 tp@0: iv = find(sum(postspeclist.')>0 ); tp@0: edgedifflist = edgedifflist(iv,:); tp@0: postspeclist = postspeclist(iv,:); tp@0: bigedgeweightlist = bigedgeweightlist(iv,:); tp@0: validEDIRcoords = validEDIRcoords(iv,:); tp@0: tp@0: patternthatisOK = [edgedifflist postspeclist]; tp@0: [patternthatisOK,iv,slask] = unique(patternthatisOK,'rows'); tp@0: edgedifflistin = edgedifflist(iv,:); tp@0: postspeclistin = postspeclist(iv,:); tp@0: bigedgeweightlistin = bigedgeweightlist(iv,:); tp@0: validEDIRcoordsin = validEDIRcoords(iv,:); tp@0: tp@0: end tp@0: tp@0: if kk == 2 tp@0: maxrownumber = max(lengthNdiffmatrix(1:2)); tp@0: [edgedifflist,startandendpoints,prespeclist,midspeclist,postspeclist,validISEDcoords,validEDIRcoords,listguide,listofallspecs] = EDB1diff2ISES(eddatafile,S,R,... tp@0: IVNDIFFMATRIX(1:maxrownumber,1:2),lengthNdiffmatrix(1:2),... tp@0: specorder,visplanesfromR,vispartedgesfromS,vispartedgesfromR,nedgesubs,ndecimaldivider,edgedifflistin,postspeclistin,... tp@0: bigedgeweightlistin,validEDIRcoordsin,edgeplaneperptoplane1,edgeplaneperptoplane2); tp@0: tp@0: [nrows,nsubsegmentcols] = size(startandendpoints); tp@0: nsubsegments = uint8((startandendpoints(:,2:4:nsubsegmentcols))~=0); tp@0: if nrows > 1 & nsubsegmentcols > 4 tp@0: nsubsegments = sum(nsubsegments.').'; tp@0: end tp@0: nmaxsubsegments = max(nsubsegments); tp@0: tp@0: elseif kk >= 3 tp@0: maxrownumber = max(lengthNdiffmatrix(1:kk)); tp@0: tp@0: [edgedifflist,startandendpoints,prespeclist,postspeclist,validISEDcoords,validEDIRcoords,listguide,listoforders] = EDB1diffNISES(eddatafile,S,R,... tp@0: IVNDIFFMATRIX(1:maxrownumber,1:kk),lengthNdiffmatrix(1:kk),kk,... tp@0: specorder,visplanesfromR,vispartedgesfromS,vispartedgesfromR,nedgesubs,ndecimaldivider,edgedifflistin,postspeclistin,... tp@0: bigedgeweightlistin,validEDIRcoordsin); tp@0: end tp@0: tp@0: [nvalidcombs,slask] = size(listguide); tp@0: if kk >= 3 tp@0: nprespecs = listoforders(:,2) - 1; tp@0: npostspecs = listoforders(:,1) - nprespecs - kk; tp@0: else tp@0: nprespecs = listofallspecs(:,1); tp@0: nmidspecs = listofallspecs(:,2); tp@0: npostspecs = listofallspecs(:,3); tp@0: listoforders = nprespecs+nmidspecs+npostspecs+2; tp@0: end tp@0: tp@0: for ii = 1:nvalidcombs tp@0: ncombs = listguide(ii,1); tp@0: i1 = listguide(ii,2); i2 = listguide(ii,3); tp@0: if kk == 2 tp@0: pathtypevec = [pathtypevec; ['s'*ones(ncombs,nprespecs(ii)) 'd'*ones(ncombs,1) 's'*ones(ncombs,nmidspecs(ii)) 'd'*ones(ncombs,1) 's'*ones(ncombs,npostspecs(ii)) zeros(ncombs,specorder-listoforders(ii)) ]]; tp@0: else tp@0: pathtypevec = [pathtypevec; ['s'*ones(ncombs,nprespecs(ii)) 'd'*ones(ncombs,kk) 's'*ones(ncombs,npostspecs(ii)) zeros(ncombs,specorder-listoforders(ii)) ]]; tp@0: end tp@0: tp@0: if kk == 2 tp@0: reflpaths = [reflpaths; [prespeclist(i1:i2,1:nprespecs(ii)) edgedifflist(i1:i2,1) midspeclist(i1:i2,1:nmidspecs(ii)) edgedifflist(i1:i2,2) postspeclist(i1:i2,1:npostspecs(ii)) zeros(ncombs,specorder-listoforders(ii)) ]]; tp@0: else tp@0: reflpaths = [reflpaths; [prespeclist(i1:i2,1:nprespecs(ii)) edgedifflist(i1:i2,1:kk) postspeclist(i1:i2,1:npostspecs(ii)) zeros(ncombs,specorder-listoforders(ii)) ]]; tp@0: end tp@0: tp@0: specextradata = [specextradata;[ validISEDcoords(i1:i2,1:3) validEDIRcoords(i1:i2,1:3) zeros(ncombs,(specorder-1)*3) ]]; tp@0: edgeextradata = [edgeextradata;[startandendpoints(i1:i2,1:kk*2) zeros(ncombs,(specorder-kk)*2) ]]; tp@0: if kk == 2 tp@0: mainlistguidepattern = [mainlistguidepattern;['s'*ones(1,nprespecs(ii)) 'd' 's'*ones(1,nmidspecs(ii)) 'd' 's'*ones(1,npostspecs(ii)) zeros(1,specorder-listoforders(ii))]]; tp@0: else tp@0: mainlistguidepattern = [mainlistguidepattern;['s'*ones(1,nprespecs(ii)) 'd'*ones(1,kk) 's'*ones(1,npostspecs(ii)) zeros(1,specorder-listoforders(ii))]]; tp@0: end tp@0: tp@0: for jj = 2:nmaxsubsegments tp@0: ivsub = find(nsubsegments(iv)>=jj); tp@0: ncombssubset = length(ivsub); tp@0: if ncombssubset > 0 tp@0: pathtypevec = [pathtypevec; ['s'*ones(ncombssubset,nprespecs(ii)) 'd'*ones(ncombssubset,1) 's'*ones(ncombssubset,nmidspecs(ii)) 'd'*ones(ncombssubset,1) 's'*ones(ncombssubset,npostspecs(ii)) zeros(ncombssubset,specorder-listoforders(ii)) ]]; tp@0: reflpaths = [reflpaths; [prespeclist(iv(ivsub),1:nprespecs(ii)) edgedifflist(iv(ivsub),1) midspeclist(iv(ivsub),1:nmidspecs(ii)) edgedifflist(iv(ivsub),2) postspeclist(iv(ivsub),1:npostspecs(ii)) zeros(ncombssubset,specorder-listoforders(ii)) ]]; tp@0: specextradata = [specextradata;[ validISEDcoords(iv(ivsub),1:3) validEDIRcoords(iv(ivsub),1:3) zeros(ncombssubset,(specorder-1)*3) ]]; tp@0: edgeextradata = [edgeextradata;[startandendpoints(iv(ivsub),(jj-1)*4+1:(jj-1)*4+4) zeros(ncombssubset,(specorder-1)*4) ]]; tp@0: expandedlistguide(ii,1) = expandedlistguide(ii,1) + ncombssubset; tp@0: expandedlistguide(ii,3) = expandedlistguide(ii,3) + ncombssubset; tp@0: for kk = ii+1:nvalidcombs tp@0: expandedlistguide(kk,2:3) = expandedlistguide(kk,2:3) + ncombssubset; tp@0: end tp@0: end tp@0: end tp@0: tp@0: end tp@0: tp@0: [n1,n2] = size(mainlistguide); tp@0: if n1 > 0 tp@0: listoffset = mainlistguide(n1,3); tp@0: else tp@0: listoffset = 0; tp@0: end tp@0: mainlistguide = [mainlistguide;[listguide(:,1) listguide(:,2:3)+listoffset]]; tp@0: tp@0: end tp@0: tp@0: end tp@0: tp@0: [n1,n2] = size(mainlistguide); tp@0: if firstdiffrow > n1 tp@0: firstdiffrow = 0; tp@0: end tp@0: tp@0: %------------------------------------------------------- tp@0: % Is the source or receiver directly at a plane? tp@0: tp@0: Sinsideplanenumber = find(visplanesfromS==4); tp@0: tp@0: Rinsideplanenumber = find(visplanesfromR==4); tp@0: tp@0: %------------------------------------------------------- tp@0: % Get rid of empty columns tp@0: tp@0: if ~isempty(pathtypevec) tp@0: checksum = sum(pathtypevec); tp@0: ncols = length(checksum); tp@0: while checksum(ncols) == 0 tp@0: pathtypevec(:,ncols) = []; tp@0: checksum = sum(pathtypevec); tp@0: ncols = length(checksum); tp@0: end tp@0: end tp@0: tp@0: %------------------------------------------------------- tp@0: % Save the output data tp@0: tp@0: specextradata = sparse(specextradata); tp@0: edgeextradata = sparse(edgeextradata); tp@0: pathtypevec = uint8(pathtypevec); tp@0: [ncombs,slask] = size(reflpaths); tp@0: if ncombs+1 < 256 tp@0: mainlistguide = uint8(mainlistguide); tp@0: elseif ncombs+1 < 65536 tp@0: mainlistguide = uint16(mainlistguide); tp@0: else tp@0: mainlistguide = uint32(mainlistguide); tp@0: end tp@0: tp@0: Varlist = [' pathtypevec reflpaths specextradata edgeextradata S R mainlistguide mainlistguidepattern directsoundrow allspecrows firstdiffrow Sinsideplanenumber Rinsideplanenumber']; tp@0: tp@0: eval(['save ',edpathsfile,Varlist])