Comparing R vs Matlab for Speed: Processing 5000x2 Matrices

In summary, the individual is seeking advice on which programming environment, R or Matlab, would be faster for manipulating a large data set consisting of 5000 excel sheets with 500x7 matrices. They plan to perform various operations, such as addition, multiplication, and regression analysis, on combinations of these matrices. They believe Matlab would be the best tool for this task, but acknowledge that R has a larger library of data analysis functions. They also mention that Matlab can be slow when using for loops and suggest using vectorized commands instead. They plan to try their project in Matlab and hope to avoid using large for loops, but may need to look into parallel programming.
  • #1
Physics_wiz
228
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
  • #2
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.
 
  • #3
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.
 
  • #4
might want to look into parallel programming though MATLAB should be able to handle that size depending on your hardware
 
  • #5
Matlab is notoriously slow when using for loops. Be sure to use vectorized commands whenever possible.
 

1. How do R and Matlab compare in terms of speed for processing 5000x2 matrices?

R and Matlab both have their strengths and weaknesses when it comes to processing large matrices. In general, R tends to be slower than Matlab due to its interpreted nature, while Matlab's compiled code allows for faster execution. However, the specific operations being performed on the matrices can also greatly impact the speed of processing.

2. Is there a significant difference in processing speed between R and Matlab for 5000x2 matrices?

The difference in speed between R and Matlab for processing 5000x2 matrices can vary depending on the specific operations being performed. In some cases, the difference may be negligible, while in others it can be significant. It is important to test and compare the execution times for your specific use case to determine the impact on performance.

3. Which language is better for processing large matrices: R or Matlab?

Neither R nor Matlab can be definitively considered better for processing large matrices. Both languages have their own strengths and weaknesses, and the choice ultimately depends on the specific use case and the user's familiarity with each language. It is recommended to compare the execution times for your specific operations in both R and Matlab to determine which is more efficient for your needs.

4. Can the processing speed for 5000x2 matrices be improved in R or Matlab?

There are various techniques and optimizations that can be applied in both R and Matlab to improve the processing speed for 5000x2 matrices. This can include using vectorized operations, avoiding unnecessary loops, and utilizing parallel processing. It is important to analyze and optimize your code to achieve the best performance.

5. Are there any other factors besides speed that should be considered when choosing between R and Matlab for processing 5000x2 matrices?

While speed is an important factor, there are other considerations to take into account when choosing between R and Matlab for processing 5000x2 matrices. These include the user's familiarity with each language, the availability of packages and tools for specific tasks, and the cost of the software. It is important to weigh all of these factors to determine the best fit for your particular needs.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
32
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
569
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
6K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
666
Back
Top