Matlab and several related programming languages are designed for carrying out mathematical calculations. Ruby is designed to be a multi-purpose language that has found a niche in Web-development. My advice is to use the right tool for the job, and not to try and force a round cylinder into a square hole.