Comparing R vs Matlab for Speed: Processing 5000x2 Matrices

Click For Summary

Discussion Overview

The discussion centers around the comparison of R and Matlab for processing large datasets, specifically focusing on the speed and efficiency of each programming environment when handling numerous 500x7 matrices and performing operations on combinations of these matrices. The context includes data manipulation tasks such as addition, multiplication, and regression analysis.

Discussion Character

  • Debate/contested
  • Technical explanation
  • Exploratory

Main Points Raised

  • One participant expresses the need for a faster alternative to Excel for manipulating a large number of matrices and seeks insights on the performance of R versus Matlab.
  • Another participant suggests that Matlab may be the better tool for the task, citing its capabilities, but notes that R has a larger library of data analysis functions.
  • A participant mentions that they already have Matlab and plans to test it, expressing concerns about the performance of for loops based on a previous experience with a large matrix operation that took a significant amount of time.
  • One reply recommends looking into parallel programming to improve performance, indicating that Matlab should be able to handle large datasets depending on hardware.
  • Another participant warns that Matlab is slow when using for loops and advises using vectorized commands to enhance efficiency.

Areas of Agreement / Disagreement

Participants express differing opinions on the performance of R versus Matlab, with no consensus reached on which is definitively faster. Concerns about the efficiency of for loops in Matlab are acknowledged, but there is no agreement on the best approach to take.

Contextual Notes

Participants highlight potential performance issues with for loops in Matlab and suggest alternatives like vectorization and parallel programming, but do not resolve the implications of these suggestions on the overall performance comparison between R and Matlab.

Physics_wiz
Messages
227
Reaction score
0
I have a huge set of data. About 5000 excel sheets and in each one about a 500x7 matrix. I'll be doing a lot of manipulation where I'll need a programming environment that is faster than excel (excel is pretty slow). Anyone have experience with both R and Matlab and can comment on which one is faster?

Just to give an idea of what I will be doing, out of those 5000 matrices, I will have to do some work with every combination of 2 from the total 5000. So I will have 5000 C 2 combinations or 12,497,500 combinations. After I choose which two matrices I'll work with, I will have to do things like addition, multiplication, and regression analysis on specific columns in the two matrices.
 
Last edited:
Physics news on Phys.org
After I choose which two matrices I'll work with, I will have to do things like addition, multiplication, and regression analysis on specific columns in the two matrices.

I think Matlab is the best tool for this task. I would only used R if you required a larger library of data analysis functions. That said, Matlab is far from free, and R is much better then Excel.
 
I already have Matlab, so price is not an issue. I will give this project a shot in Matlab and see how it goes. I was a little worried today when I wrote two for loops to make a matrix that's 1000x35,000 and give every element a specific value because it took 45 minutes to run and after I stopped it the matrix was about half way done. I will try to avoid huge for loops like that in my program, but I don't know how long it would take to run if I had to have something like this.
 
might want to look into parallel programming though MATLAB should be able to handle that size depending on your hardware
 
Matlab is notoriously slow when using for loops. Be sure to use vectorized commands whenever possible.
 

Similar threads

  • · Replies 32 ·
2
Replies
32
Views
4K
  • · Replies 4 ·
Replies
4
Views
7K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 13 ·
Replies
13
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 7 ·
Replies
7
Views
6K
  • · Replies 7 ·
Replies
7
Views
7K