Asked by maysarah sulaiman
on 25 May 2013

i have 10 pcs of 200 by 200 dim of images. then i formed a matrix with the 10 by 40000. some of the column consist the same value from top to bottom, therefore i want to eliminate or replace it with 0. i have try repmat and std or even mean. i want to have only the significant features of my image so that i can perform PCA using princomp function.tq 4 ur help.

*No products are associated with this question.*

Answer by Image Analyst
on 25 May 2013

Accepted answer

Try this:

% Generate sample data: columns = 18; % Could be 40000 or size(m, 2) rows = 4; m = randi(4, rows, columns)

% ----- HERE'S THE MAIN CODE --------------------------- % Find out where the entire column is the same number % by taking the mean of the column and seeing % if the mean of the column is the same as the first row. columnAllTheSame = mean(m) == m(1,:) % Set those that are all the same to 0: m(:, columnAllTheSame) = 0

Show 3 older comments

maysarah sulaiman
on 26 May 2013

i have try the code, but it returns me all column 0.can u elaborate more on the codes?

Image Analyst
on 26 May 2013

maysarah sulaiman
on 27 May 2013

urm i just realize that i define it wrongly. i got it already.thanks a lot.

Answer by Azzi Abdelmalek
on 25 May 2013

Use unique function

help unique

maysarah sulaiman
on 25 May 2013

Opportunities for recent engineering grads.

## 2 Comments

## Azzi Abdelmalek (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/76936#comment_150915

What is O ?

## maysarah sulaiman (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/76936#comment_150927

oh actually i typed it wrongly just now, i have amend my question.tq