I'm trying to permute a cell of strings and get the unique rows back. Example: I'm giving four values and it permutes those values and gives those values back in rows of two. This works below but I notice the rows repeat in some areas. I tried adding the unique command out=unique(perms(A),'rows') but that comes back with an error.
clear all
more off
A={'(+)sig','(-)sig','(+)flip','(-)flip'}
out=perms(A);
for n=1:length(out)
%fprintf([num2str(n), ',', out{n,1},',',out{n,2},',',out{n,3},'\n'])
fprintf([num2str(n), ',', out{n,1},',',out{n,2},'\n'])
end
Results:
1,(+)sig,(-)sig
2,(-)sig,(+)sig
3,(+)sig,(+)flip
4,(-)sig,(+)flip
5,(+)flip,(+)sig
6,(+)flip,(-)sig
7,(+)sig,(-)sig
8,(-)sig,(+)sig
9,(+)sig,(+)flip
10,(-)sig,(+)flip
11,(+)flip,(+)sig
12,(+)flip,(-)sig
13,(+)sig,(-)flip
14,(-)sig,(-)flip
15,(+)sig,(-)flip
16,(-)sig,(-)flip
17,(+)flip,(-)flip
18,(+)flip,(-)flip
19,(-)flip,(+)sig
20,(-)flip,(-)sig
21,(-)flip,(+)sig
22,(-)flip,(-)sig
23,(-)flip,(+)flip
24,(-)flip,(+)flip
The issue is that some of the values double up see below how can I have the rows be unique rows?
1,(+)sig,(-)sig
7,(+)sig,(-)sig
2,(-)sig,(+)sig
8,(-)sig,(+)sig
etc..
Ps: I'm using Octave 4.0 which is like Matlab