This forum is a great place to get help on specific questions related to MATLAB but it sounds like you're looking for help to get started on your project. Feel free to edit your question with a specific MATLAB question.
Cleve's Corner blog has several recent articles on graphically creating rubiks cubes but does not get into the topic you're describing.