Skip to content

Instantly share code, notes, and snippets.

@Longlius
Created April 2, 2015 11:16
Show Gist options
  • Save Longlius/dc60bf3cbff51713af86 to your computer and use it in GitHub Desktop.
Save Longlius/dc60bf3cbff51713af86 to your computer and use it in GitHub Desktop.
Cartesian product bullshit in Matlab for Ryan
Xbuilder = cell(1, 27);
for x = 1:3
for y = 1:3
for z = 1:3
i = (((x - 1) * 9) + ((y - 1) * 3) + (z - 1)) + 1;
Xbuilder{1,i} = [x 0 0; 0 y 0; 0 0 z;];
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment