MATLAB: Hello everyone, given a value i need to find just the column index of this value in an array. Any way to get this done

findindexindexing

for i = 1:504 %cc is a vector with same height as aaa should be and b is a big matrix
%cc contains the value that is in b and i want to know the column position in b
aaa(i) = find(cc(i) == b)); %where aaa should be the vector with the column index I need
end
the first problem encountered with find is that it returns me the row and the second is that even though I specify in the find function to give me also the column I cannot put [row,col] = find() in a for loop or if yes do you have an idea of how to perform this?

Best Answer

[~,aaa(i)] = find(cc(i)==b));