MATLAB: Finding column # that contains an integer in a matrix find indexmatrix hi, I want to find indices of columns of a matrix which contains a specific integer. say magic(5), how can I find column numbers that has got '5' in it if it exists! thanks, Mehrdad Best Answer X = your matrix;indices = find(any(X==5)); % columns that have the number 5 in them Related SolutionsMATLAB: How to find rows in a matrix that have elements in a certain column that satisfy certain condition and create a new matrix out of those rows tf = ismember(YourMatrix(:,5), [0, 2, 10]);NewMatrix = YourMatrix(tf, :); MATLAB: How to find the column indices of the latest row’s minimum value [~, idx] = min(A(end,:)); Related Question# of elements mismatchPrinting row index or row of a matrix by searching for a particular valueHow to graph sharps #Finding Rest of RowFgetl skips lines beginning with #Find column where one value is NaN
Best Answer