if the cell duplicated put last column in the previous row
Show older comments
i run this code but it gives an error:
j=1;
rowsize=length(defs);
data1=cell([rowsize,C2]); % create array with size [R,C]
for j=1:length(defs) % loop over Mdr of defib
querymdr=data2{j,1}; % save MDR numbers
y=alldata{:,1};
idx= find(y==querymdr); % find in alldata MDR equals def
record=[alldata{idx(1),:}]; % copy the 1st search result
for k=2:length(idx)% over all MDR number of text
record = [record,(alldata(idx(k),6))];
end
data1(j,:)=record; % put combined record into result table
end
what is the wrong thing ?
5 Comments
Walter Roberson
on 12 May 2015
What is the error message and which line of code does it appear on?
Jan
on 13 May 2015
@amr: Without seeing the error message and without your input data there is no chance to find the problem of your code.
Amr Hashem
on 14 May 2015
Edited: Amr Hashem
on 14 May 2015
Walter Roberson
on 14 May 2015
What is class(y) and size(y) when the problem occurs?
Also your code does not account for the possibility of there being no match.
Amr Hashem
on 14 May 2015
Accepted Answer
More Answers (0)
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!