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

Learn moreOpportunities for recent engineering grads.

Apply TodayWrite a function to get unique elements of a vector faster than unique()! Input will be a vector (of integers or floating point numbers) of any size. The order of the returned vector is unimportant.

Example: Input: x = [1 1 2 2 3 3]; Output: [1 2 3];

Input: x = [0.1 3.1 2.1 2.0 3.1]; Output: [0.1 3.1 2.1 2.0]; % or any order

61 correct solutions
120 incorrect solutions

Last solution submitted on Mar 18, 2016

1 player likes this solution

3 Comments

Boris Huart
on 1 Feb 2013

It was too tempting...

James
on 1 Feb 2013

I thought I was being original by trying this. Guess not... :-(

Jeremy
on 3 Feb 2013

Clever :), hadn't thought of that!

1 Comment

Jeremy
on 1 Feb 2013

thanks for the hint!

5 Comments