Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
differentiate the columns in a matrix

Subject: differentiate the columns in a matrix

From: dhuan Du

Date: 5 May, 2009 15:22:02

Message: 1 of 2

Hi, friends:

I have a matrix X with m by n dimension, I would like to know how many different columns are there in this matrix. Is there any more efficicent way to do it rather than comparing each column with other columns?

My first idea is to pick up a colum from X, such as X(:,1), and generate a matrix Y (m,n )with n columns and each colum is the same to X(:,1). Then I can use Y-X to identify whether there are dupicates for X(:,1) in X. Delete the duplicates in X and keep on doing previous steps, and finally I will get the distinguished colums in X.

But I sitll do not know how to generate maxtix Y efficiently. Does any know have some ideas?

Thank you very much!

Subject: differentiate the columns in a matrix

From: Bruno Luong

Date: 5 May, 2009 15:37:01

Message: 2 of 2

Take a look of function UNIQUE with 'ROWS' option

Bruno

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us