I have two cell arrays of size [1X5]
K= {} {O1,O2,O3,O4} {O1,O3} {O1,O2,O3,O4} {O1,O2,O3,O4}
W= {O3}{O2}{O2,O3}{O2,O4}{O4}
I want to get as a result a cell array named S
of size [1X4] as follows :
I put the contents of K{i}
in every S{j}
where j
are the indices of the contents of W{i}
(for example the cell W{3}
has as content O2
and O3
so j=2,3
. I put the content of K{3}
in the cells S{2}
and S{3}
).
After that I add in every S{i}
a content Oi
and I eliminate redundancy in S
.
The expected result is the following :
S={O1}{O1,O2,O3,O4}{O1,O3}{O1,O2,O3,O4}