ABSTRACT

Both R and MATLAB have similar and standard methods for controlling the flow of code — statements such as if/else, while, and for. The two packages are more similar than different, with mainly just some differences in the syntax used to delimit the loops. Like most programming languages, both R and MATLAB platforms also provide “if/else” statements allowing people to execute one set of statements if a condition evaluates as TRUE, and another set of statements if the condition is FALSE. MATLAB's if/else statements do not have the potential problem that R's do, because MATLAB always forces people to terminate an if statement with an end, no matter how many commands are inside the TRUE/FALSE clauses. Both R and MATLAB platforms have for loops which behave in a very similar manner. They differ somewhat from how for loops work in languages like C, C++, and Java.