Why Use RLaB ?

Ian Searle

The title says it quite succinctly. The purpose of this article is to explain why you might want to use RLaB as opposed to Matlab. This purpose of this article is not to belittle Matlab instead, I will try and point out the differences between the two programs, and consequently why you may, or may not, want to use RLaB. I have organized this article into three sections. The first is an attempt to discuss the similarities present in the two programs. The second section is an attempt to present a strictly technical argument. While the third section is left for everything else.

I would like this article to be as objective as possible, even considering who it is written by. If you feel that I have unfairly criticized Matlab or drawn invalid comparisons, please feel free to write me at ians@eskimo.com to express your opinions.


Both programs are Very High Level languages (VHLL) oriented towards applied mathematics. As languages, both offer numerical and string variables and arrays, conditional and flow-control constructs, and functions. Both programs offer an interface to the more popular linear algebra functions available through Netlib1. Both programs offer convenient visualization of data through two and three dimensional plotting functions.

As VHLL with convenient data visualization, both programs offer an environment for numerical computation, experimentation, and algorithm development that is generally more productive that the traditional develop--compile--link--run--debug cycle we are all familiar with.

Technical Differences

Now I will attempt to point out the technical differences between the two programs.

  1. The Matlab language supports one data type, the matrix. The matrix is used to represent scalars, vectors (1-D arrays), and matrices (2-D arrays). The matrix is also used to represent vectors of characters, and matrices of characters. Matlab versions 4.x added a sparse matrix. Any numerical matrix can be either real or complex.

    RLaB offers more than the matrix as a data type. However, the matrix is probably the most often used data structure. Like Matlab, RLaB's matrices are used to represent scalars, vectors, and matrices, both real and complex. At this point in time RLaBdoes not offer a sparse matrix.

    In addition to the matrix, RLaB has a string class, and data type. A string is a variable length collection of characters. Both string vectors, and string matrices are supported. One advantage to the addition of this type is the ability to collect strings of different lengths in the same vector or matrix.

    However, the most significant improvement is RLaB's list class. A list is a heterogeneous associative array that can contain any data type, including other lists. The list gives RLaBusers the opportunity to structure their data as necessary. Some possible uses are:

  2. Matlab functions have some severe (in my opinion) limitations:

    In RLaB, we try to overcome these limitations with the following:

  3. Matlab and RLaB also differ some in Input/Output (I/O) capabilities. Both offer ASCII and binary I/O for all types of data. However, RLaB offers the ability to read and write through pipes. Any function that takes a filename as an argument can also be given a process to read or write data to or from. For example: fprintf can be used to send commands or data to a process

    fprintf ("| gnuplot", "plot %s using 1:3\n", tmp_file_name);

    Or readm can be used to read the output of a filter on some pre-existing data.

    x = readm ("| awk -f data_filter.awk < orig_data");

  4. Matlab has a ``Fortran-ish'' style syntax. RLaB has a C style syntax. This is a matter of personal preference.

  5. RLaB and Matlab offer a different method of statement evaluation. The MathWorks does not explicitly discuss the language expression evaluation, so it is hard to tell what the intent is. My limited experience suggests that Matlab is composed of ``special-cases''. Whatever the internal construction, the end effect is the user must remember more syntactic idiosyncrasies with Matlab, than with many other languages.

    In RLaB expressions usually (most always) have a result. You can figure out for yourself what the result of a particular statement will be by evaluating each sub-expression, starting at the lowest level, and combining the results, until you have the answer. Sometimes this is called a substitution model of evaluation. When using RLaB there should be less idiosyncrasies to deal with.

  6. Matlab and RLaB offer mostly the same mathematical operators. The two sets of operators differ in only a few instances. RLaB has extended the operator set slightly with an element-by-element multiply, divide, add, and subtract that allow users to operate row-by-row or column-by-column.

  7. In the area of data visualization (plotting) Matlab and RLaB differ dramatically. Matlab offers a comprehensive graphical capability that does not stop at plotting data. In addition to striking two and three dimensional plots, Matlab offers the more sophisticated users the ability to create their own graphical applications with common graphical ``widgets'' such as: buttons, sliders, text entry, and more.

    RLaB offers a much simpler data visualization capability. RLaB graphics are handled through a scientific graphics library called Plplot. The Plplot API is implemented as a set of builtin functions within RLaB. Thus, the high level plotting capabilities are handled by RLaB programs. Two and three dimensional plots, contours, and histograms, with a host of options are supplied. Custom plots are can be created by utilizing the low-level Plplot API. The most popular output devices (screens and printers) are supported. When using X-windows, there is a nice ``plot-widget'' that allows the user to zoom and pan, print plots, and tweak the color-maps.

    If you need really ``gee--whiz--turbo--object--oriented'' graphics, you ought to be looking at Matlab. If you need a good programming language that offers good data visualization, then RLaB deserves a look.

  8. Matlab's linear algebra functions are based upon the sources from the LINPACK and EISPACK projects. It would be ridiculous of me to criticize these functions as MathWorks has modified/improved them over the years, and certainly there is no one better equipped to do so than Cleve Moler.

    RLaB's linear algebra functions are mostly supplied by the source code from the LAPACK project. LAPACK could be called ``LINPACK + EISPACK $2^{nd}$ Edition''. The LAPACK functions offer some block structured algorithms, and utilize levels 2 and 3 BLAS. Thus, on some machines they may provide better performance.

Other Differences

  1. Starting off with a rather practical consideration--where can you run these programs? Matlab is available from the Mathworks for most Unix workstations, MS-Windows PCs, Apple Macintoshes, VAXes and some super/mainframe computers (such as the Cray and Convex). Matlab is not available for OS/2, and some of the less popular Unix workstations. If Mathworks does not support or discontinues support for a particular platform, you can ask them to reconsider--generally you will be out of luck. Mathworks charges a substantial fee for use of their product. On some platforms the fee must be payed yearly.

    RLaBis available in binary and source-code formats. Since you can get the source code, you can port it to any platform you like. There are no charges for using RLaB. You can get free support from the RLaBuser's group, and the author. If you want more reliable support, you can pay someone (usually a consultant).

    Some would feel that RLaBis better as a long term tool, since they have the source code and can run the program on most any computer without restriction. Others would feel that since Matlab is commercially supported/developed that it is more reliable as a long term tool.

  2. Another practical consideration. You may be in the position to purchase some of Mathwork's toolboxes. These toolboxes are collections of popular numerical procedures and algorithms. There are quite a few toolboxes available: signal processing, controls, neural-networks, image-processing, etc ... These toolboxes are mostly in the form of Matlab mfiles, so that you can look at them to understand how they work. For the most part these toolboxes are not meant to be used as black-boxes.

    RLaBdoes not offer the same selection of toolboxes, either commercial or contributed. There is a growing number of contributed rfiles, and a controls, testmatrix, and signal-processing collections are in the works. But RLaB will never match Matlab's volume of toolbox material. If you are a student or in the position of writing most of your own procedures, then this may not matter much to you.


There is no way to summarize exept to say: decide for yourself. The choice is not simple, and it is worth careful consideration, since both programs can have a significant impact upon the way you do your work/learning.

About this document ...

Why Use RLaB ?

This document was generated using the LaTeX2HTML translator Version 99.2beta6 (1.42)

Copyright © 1993, 1994, 1995, 1996, Nikos Drakos, Computer Based Learning Unit, University of Leeds.
Copyright © 1997, 1998, 1999, Ross Moore, Mathematics Department, Macquarie University, Sydney.

The command line arguments were:
latex2html -no_navigation -split 0 rlab-why

The translation was initiated by Ian R. Searle on 2000-01-09


... Netlib1
... objects2
Strtod and num2str functions exist in case you are able to fool getline.

Ian R. Searle 2000-01-09