Matlab code is slower than it used to be

124 次查看(过去 30 天)
I used to run a code that takes 20 minutes on my machine and suddenly the code is very slow and take even hours to complete. I tried the code on other machines that have the same characteristics but it was much faster than mine.
The function that takes a lot of time is cast function to convert from a python dataframe to a matlab table and it takes 13 secondes per column but in other machines takes only 0,6 seconds.
I uninstalled and reinstalled matlab but it didn't help. I am using 16Gb RAM on windows 11. My matlab version is R2023a.

采纳的回答

Shishir Reddy
Shishir Reddy 2023-7-18
If the `cast` function, specifically the conversion from a Python dataframe to a MATLAB table, is taking significantly longer on your machine compared to others, there could be several potential reasons for the performance difference. Here are a few possible issues to investigate:
1. System resources: Check if your machine is experiencing resource limitations, such as high CPU or memory usage. Close any unnecessary applications or processes that might be consuming system resources and affecting MATLAB's performance.
2. MATLAB configuration: Ensure that MATLAB is properly configured on your machine. Check the MATLAB preferences and settings to make sure there are no specific configurations that could impact the performance of data conversions.
3. Python environment: Check if your Python environment is correctly set up and compatible with MATLAB. Verify that you have the necessary Python packages and versions installed, as well as any required dependencies for the data conversion process.
4. MATLAB version: Although you mentioned you are using MATLAB R2023a, double-check that your MATLAB version is the same as the other machines where the conversion is faster. Additionally, verify that there are no updates or patches available for MATLAB that might address performance issues.
5. MATLAB toolbox versions: If the data conversion relies on specific MATLAB toolboxes or packages, ensure that you have the same versions installed on your machine as the other machines. Mismatched versions could result in slower performance due to differences in implementation or optimization.
6. Machine-specific factors: Consider any hardware or software differences between your machine and the other machines where the conversion is faster. Factors such as CPU speed, memory speed, disk type (HDD vs. SSD), and other hardware configurations might contribute to the performance discrepancy.
7. MATLAB add-ons or customizations: If you have any additional MATLAB add-ons, customizations, or toolboxes installed, they could potentially affect the performance of the data conversion. Disable any unnecessary add-ons or customizations and test the code again to see if the performance improves.
8. MATLAB cache and temporary files: Clear MATLAB's cache and temporary files to ensure that old or corrupted data is not affecting the performance. MATLAB creates temporary files during execution, and if they accumulate or become corrupted, it can impact performance.
9. Profiling and debugging: Use MATLAB's profiling and debugging tools to analyze the performance of your code. Profile the code to identify any specific areas where the execution time is significantly longer, which can help narrow down the issue.
If none of these steps resolve the performance issue, it may be worth contacting MathWorks support for more specific guidance tailored to your MATLAB version and environment. They can provide further assistance in diagnosing and addressing the problem.
I hope this helps resolving the issue.
  1 个评论
Bochra
Bochra 2023-7-20
编辑:Bochra 2023-7-20
Thank you for your help! I contacted matlab support and they proposed to re-install matlab using clean installation steps and it worked.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息

产品


版本

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by