function testarray = createintarray(array,level,values)
%Create empty array to store results.
testarray=[];
%Find length of array to determine base case or recursive case.
arraylength = length(array(:,1));
%Recursive Case
if (arraylength>1)
%Step through values in array
for value = array(1,1):array(1,3):array(1,2)
%Store current value to temporary storage (values is passed)
values(level,1) = value;
%Call method on smaller portion of array
testarray=[testarray;createintarray(array(2:length(array(:,1)),:),level+1,values)];
end
%Base Case
elseif exist('values')==0
for value = array(1,1):array(1,3):array(1,2)
testarray=[testarray;value];
end
else
count=1;
%Step through values in array
for value = array(1,1):array(1,3):array(1,2)
%Copy data from values array
for valnum = 1:length(values(:,1))
testarray(count,valnum) = values(valnum,1);
end
%Copy current value into the same row of testarray
testarray(count,level) = value;
%Increment counter to copy data to next row.
count = count+1;
end
end
end