Cody

# Problem 980. Unique values without using UNIQUE function

Solution 1494778

Submitted on 16 Apr 2018 by Mohammad Abir Hassan Sarker
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
filetext = fileread('your_fcn_name.m') assert(isempty(strfind(filetext, 'unique'))) assert(isempty(strfind(filetext, 'stable'))) A = [9 2 9 5]; assert(isequal(your_fcn_name(A),unique(A,'stable')))

filetext = 'function y = your_fcn_name(x) p=x(1); for i=2:length(x) if ismember(x(i),p)==logical(0) p=[p x(i)]; end end y = p end %This code written by profile_id 12579192 ' y = 9 2 5

2   Pass
x = [42 1 1 1 42 17 17]; assert(isequal(your_fcn_name(x),unique(x,'stable')))

y = 42 1 17

3   Pass
x = rand(1,25); assert(isequal(your_fcn_name(x),unique(x,'stable')))

y = Columns 1 through 18 0.0592 0.2781 0.5093 0.1139 0.4076 0.0081 0.6877 0.5573 0.6202 0.9448 0.3412 0.9083 0.1627 0.8330 0.4101 0.8883 0.8208 0.0394 Columns 19 through 25 0.8614 0.7425 0.1693 0.0255 0.9902 0.6248 0.0762