MATLAB Comparing R vs Matlab for Speed: Processing 5000x2 Matrices

AI Thread Summary
The discussion centers on the need for a programming environment to efficiently manipulate a large dataset consisting of 5000 Excel sheets, each containing a 500x7 matrix. The user is considering R and Matlab for this task, particularly due to the extensive combinations of matrices (12,497,500) that will require operations like addition, multiplication, and regression analysis. Matlab is favored for its capabilities, especially since the user already has access to it, despite its cost. However, concerns are raised about Matlab's performance, particularly with for loops, which can be slow. Recommendations include avoiding large for loops and utilizing vectorized commands for better efficiency. Parallel programming is also suggested as a potential solution to enhance processing speed. R is acknowledged as a strong alternative, especially for its extensive data analysis libraries, but the user leans towards Matlab for this specific project.
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
Views
4K
Replies
13
Views
3K
Replies
1
Views
2K
Replies
1
Views
3K
Replies
6
Views
2K
Replies
4
Views
2K
Replies
7
Views
6K
Replies
7
Views
6K
Replies
3
Views
2K
Back
Top