File Exchange Pick of the Week

September 14th, 2005

Rubik’s Cube + New Programming Features

Our loyal readers have probably figured out by now that I'm the goofy one who spends all day looking for fun things to do with MATLAB. So, it surely comes as no surprise that I've picked Alexander Mueller's Rubik's Cube this week. You've got to check this out - besides being a faithful rendering of the classic original, it looks great. He even programmed in my favorite trick - "solving" the puzzle by moving the stickers around instead of the actual pieces. I've actually got a more serious motivation behind this week's pick. Alexander makes very effective use of two new programming features introduced in MATLAB 7 last year. By using nested functions, he wrote very compact and readable code for a user interface. Alexander created the GUI components in the main function, which makes their handles visible inside all of the nested functions (without having to pass anything around). Alexander also used the new hgtransform graphical object. These allow you to manipulate multiple graphical objects (like patches) as if they were a single object. In his application, this eliminates the very tedious programming of calculating all of the cartesian coordinates for every face of every block in the cube. It's always great for me to see when and how people adopt the new features that we put into the language. Thanks for the hours of fun and the nice programming lesson, Alexander!

Comments are closed.


Bob, Brett & Jiro share their favorite user-contributed submissions from the File Exchange.

  • Zach: Hi Doug and Les, I didn’t have a lot of time to mess with this, but I did find a work-around. I plotted...
  • hamed: k
  • Les: @Zach This isn’t exactly what you are looking for but at least it puts all three parameters on the same...
  • Zach: Thanks for your suggestions Doug. I’ll give that a shot and see what happens. I’ve seen many of...
  • Doug: @Zach, I would say to use plotYYY, because that is close to what you want, but using depth as Y makes sense....
  • Doug: @Teja, I think this will work: http://www.mathworks .com/access/helpdesk /help/techdoc/ref...
  • Gify: merry christmas :) nice christmas tree! Regards, Janet Gify
  • Teja: Dear Doug Is there anyway to plot a surface from nonuniform data without meshgrid and griddata? Basically i...
  • Zach: I’m working with geophysical data, so I’d like to produce a depth profile. The y-axis would be...
  • Doug: @Ashok First, please do not use variable names that are MATLAB commands (std and mean). Second, p(j) should be...

These postings are the author's and don't necessarily represent the opinions of The MathWorks.