algorithm - Permutation of all the characters when few characters are always together -


i trying obtain permutation of characters in string lets 'kiran'. can use :

perms('kiran')

this returns permutation of character in string factorial(5)=120. now, looking obtain, permutation of string when characters 'ira' together.

the answer factorial(3) = 6.

i write module returns permutation of characters, 'ira' together.

any idea how programmatically obtain in matlab?

thanks

x={'k','ira','n'} %one permutation per row y=x(perms(1:numel(x))) %concatinate rows y=arrayfun(@(x)[y{x,:}],1:size(y,1),'uniformoutput',false) 

Comments

Popular posts from this blog

Change the color of an oval at click in Java AWT -

c# - Unity IoC Lifetime per HttpRequest for UserStore -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -