MATLAB freezes when running code blocks

67 Ansichten (letzte 30 Tage)
Adam Shaw
Adam Shaw am 1 Apr. 2022
Kommentiert: Sergey I am 21 Jun. 2022
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 Kommentare
Adam Shaw
Adam Shaw am 1 Apr. 2022
Bearbeitet: Adam Shaw am 1 Apr. 2022
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 am 1 Apr. 2022
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.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Yash Srivastava
Yash Srivastava am 5 Apr. 2022
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:

Kategorien

Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by