MATLAB: How can i extract Index values of different cell arrays

mathematicsMATLAB

I want to extract the cell arrays w.r.to the index num,
for w =1:length(mydata)
%[~,I]= find(mydata{w, 2}(:,2)) = find(mydata{w, 1}(:,1));
for o = 1:length(mydata{w,2})
index = find(mydata{w, 2}(:,2) == mydata{w, 1}(:,1)== o);
mydata{w,3} = index;
end
end
I have a cell which contains max and its index values in each row. Now i want to find max index values in another cell and extract those values( matrix 1*2, here i want to extract only 1st col value only). for ex. [M,I] = [2,295]. 295 index value of its max value in certain row, let say (6,26321) is the extracted index value in another cell. extract value is 6(1st col) similarly all other row cells matrix. Thanks in advance.

Best Answer

Something like this should work.
s = load('mydata21.mat')
s=s.mydata21;
c=s(:,2) %arrays with indices
d=s(:,1) %arrays with values
out=cellfun(@(x,y)y(x(2),1),c,d)