MATLAB freezes when running code blocks

67 ビュー (過去 30 日間)
Adam Shaw
Adam Shaw 2022 年 4 月 1 日
コメント済み: Sergey I 2022 年 6 月 21 日
I've been experiencing problems with a MATLAB installation on a new computer. I am running R2021B on Windows 10 Pro (results from running ver are below).
Essentially everything is fine when I directly run a code in a file via for instance the "run" in the toolbar; however, whenever I try to run code either from the command window or by doing Ctrl-Enter on a code block (defined by "%%") MATLAB will freeze up, saying it is busy for several seconds, even for the most simple tasks (i.e. even running 1+1 will freeze it for several seconds). Even more weird. Oftentimes when I do Ctrl-enter on a code block, MATLAB will just sit there, doing/outputting nothing. When I then go to the command window and do anything (i.e. even just press enter), MATLAB will immediately enter this frozen busy state for several seconds before eventually outputting the result.
I saw online that a somewhat similar problem was caused by having source control on, but even with it off the same problem persists. Any advice for troubleshooting this would be greatly appreciated, as it makes for a very frustrating programming experience.
ver results (license info omitted):
MATLAB Version: 9.11.0.1769968 (R2021b)
Operating System: Microsoft Windows 10 Pro Version 10.0 (Build 19043)
Java Version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
  3 件のコメント
Adam Shaw
Adam Shaw 2022 年 4 月 1 日
編集済み: Adam Shaw 2022 年 4 月 1 日
To clarify, this problem is code independent. The same freezing up occurs even when I type something as simple as 1+1 into the command line, or if I do ctrl+enter for a code block which is
%%
1+1
It basically happens whenever I try to execute any code from the command window or via ctrl+enter
Riccardo Scorretti
Riccardo Scorretti 2022 年 4 月 1 日
It's really weird. I suggest you to signal this bug - because if it is code independent, it is a bug. I never experienced such a problem, I'm sorry I cannot help.

サインインしてコメントする。

回答 (1 件)

Yash Srivastava
Yash Srivastava 2022 年 4 月 5 日
Hi Adam,
You may try the following troubleshooting steps:
1. Make a copy of pathdef.m file outside of your MATLAB path which can be located by using the following command:
which -all pathdef
2. Please execute the following commands in the MATLAB Command Window to restore the default MATLAB search path and rehash the toolbox cache:
restoredefaultpath
rehash toolboxcache
3. Please use MATLAB to see if the issue occurs again. If the issue is resolved, then you may want to save the new MATLAB search path by executing the following command:
savepath
NOTE: This will remove any custom paths you may have created. The following MATLAB Answers post is an additional resource on how to back them up:
  1 件のコメント
Sergey I
Sergey I 2022 年 6 月 21 日
Thanks, this worked for me

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by