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:
Finding number of unique cells

Subject: Finding number of unique cells

From: Ryan Miller

Date: 21 Dec, 2010 20:42:05

Message: 1 of 2

I have a 1xN cell, 'stim', with each cell containing a single matrix. I'd like to find the number of unique matrices contained within stim. I was hoping to be able to use unique(stim), but that doesn't work. I could also use a nested for loop through length of stim and use something like isequal(stim{i},stim{i+j}), but that seems rather ugly. There must be a one-line method of achieving some integer output of the number of unique cells. Any help is much appreciated?

Needs to be R2008b and R2009a compatible.

Subject: Finding number of unique cells

From: Sean de

Date: 21 Dec, 2010 20:52:20

Message: 2 of 2

"Ryan Miller" wrote in message <ier3et$o5k$1@fred.mathworks.com>...
> I have a 1xN cell, 'stim', with each cell containing a single matrix. I'd like to find the number of unique matrices contained within stim. I was hoping to be able to use unique(stim), but that doesn't work. I could also use a nested for loop through length of stim and use something like isequal(stim{i},stim{i+j}), but that seems rather ugly. There must be a one-line method of achieving some integer output of the number of unique cells. Any help is much appreciated?
>
> Needs to be R2008b and R2009a compatible.


Why don't you read my answer in your duplicate post?

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