I'm using the script below to try to find all the matches in a column of 2 excel files. The intersect function returns indices which are out of bounds for the first cell (patternsize is 41351 x 1, dataP is 2000 x 1). The first cell of "ic" is 41352, and for "id" it is 6001. The first cell of D is then blank. When I try to pass all of this on in the next line, everything blows up and I get the error 'Index exceeds matrix dimensions'. The script seemed to work fine with other files with different dimensions. I'm pretty much a novice with this, so any suggestions as to what is going wrong is greatly appreciated.
[numdataP,patternsizeP]=xlsread('state.xlsx');[~,dataP]=xlsread('pinellas.xlsx');[D,ic,id] = intersect(patternsizeP,dataP)indexP=cellfun(@(x)find(ismember(dataP,x)==1),D,'uniformoutput',false)
Best Answer