function allPossiblePermutations = generateOnes(lengthOfString) %%There are going to be 2^n possible combinations of 1 and -1 given n %%places to put 1 and -1. allPossiblePermutations = ones(2^(lengthOfString),lengthOfString); %%This loop generates arrays of length 'lengthOfString' long %%containing all possible combinations of 1 and -1. Example: %%length: 1 - [(1)(-1)] is returned. %%length: 2 - [(11)(-11)(1-1)(-1-1)] is returned. %%length: 3 - [(111)(-111)(1-11)(11-1)(-11-1)(1-1-1)(-1-11)(-1-1-1)] is %%returned. for i=0:((2^(lengthOfString))-1) binaryNumbers = de2bi(i,lengthOfString); allPossiblePermutations((i+1),:) = replaceZeroes(binaryNumbers,lengthOfString); end end
Not enough input arguments. Error in generateOnes (line 5) allPossiblePermutations = ones(2^(lengthOfString),lengthOfString);