MATLAB: Find a row with a column value don’t remove duplicated cells

data matchingdon't remove duplicatesearch in a row cell

i compare data in two sheets, if there are a dublicated row i want to save its last cell column in the previous row i use for i=1:size(alldata,1) for j=1:length(defs)
if data2{j,1}==alldata{i,1} % compare MDR in two files, if equal
data1(j,:)=alldata(i,:); % put all data of text in array(data1)
if data1{j-1,1} == data1{j,1} % here it gives me error
data1(j,C2+1)=alldata(i,6); % put dyplicated text in C7 works good
but it gives me error in
" if data1{j-1,1} == data1{j,1}"
how i can solve this ?

Best Answer

  • for j=1, it is trying to access data1{0,1} but matlab indexing starts from 1.