MATLAB: How to delete an entire column if any 1 element in that column is above a threshold

array indexingcolumn deletioncolumn-manipulationMATLAB

I have a 3 by 5 column oriented matrix, i.e. each column is the terminal voltages of a 3 bus electrical network for 5 different systems (see the matrix below). I would like to delete any column in which the voltages are greater than 1.2. I have tried to do this with logical indexing but it in a way row oriented. [1.186 1.464 1.111 1.609 1.482; 1.086 1.259 0.907 1.054 1.013; 1 1 1 1 1]
For this case, i would like to delete columns 2,4, and 5. Any help is appreciated. Thank you.

Best Answer

A is your matrix.
A(:,max(A)>1.2)=[];