|
On 11/23/2012 8:34 AM, Jerry wrote:
> Hello,
>
> I am using "nchoosek" to create all possible combinations of four things taken 3 at a time. See below:
>
> nchoosek(['a';'b';'c';'d'],3)
> ans =
>
> abc
> abd
> acd
> bcd
>
> However, I would like to modify "nchoosek" or using another function to add following combinations to the above answer.
>
> aaa
> bbb
> ccc
> ddd
>
> Thanks,
> Jerry
>
is it ok to just add them?
--------------------
L = ['a';'b';'c';'d'];
N = 3;
r = [nchoosek(L,N) ; repmat(L,1,N)]
---------------------
abc
abd
acd
bcd
aaa
bbb
ccc
ddd
--Nasser
|