Every time I try to set a breakpoint, the red circle comes up as long as I keep 'holding' the click, but then when I 'release' the click, it goes away. I used to be able to set breakpoints normally but now I can't

2 commentaires

Tommy
Tommy le 4 Avr 2020
Is this for all files or just a particular file? If the latter, did you happen to edit the file while you were debugging it? I've had similar issues in the past, and if restarting MATLAB did not fix it, I was able to fix it by just copying my code to a new file.
Martin Contreras Carrera
Martin Contreras Carrera le 5 Avr 2020
This is happening for all files

Connectez-vous pour commenter.

 Réponse acceptée

Anmol Dhiman
Anmol Dhiman le 9 Avr 2020

2 votes

Hi Martin,
This may be related to an issue with the caching. Try running the following commands, and then try debugging again:
>> restoredefaultpath
>> rehash toolboxcache
If this works, run the command below:
>> savepath
Incase the above solution didnot help , do let me know.
Thanks,
Anmol Dhiman

3 commentaires

Bob
Bob le 17 Fév 2026
I have the exact same issue, in MATLAB 2025B. Running these two commands:
>> restoredefaultpath
>> rehash toolboxcache
Did NOT fix the problem.
Walter Roberson
Walter Roberson le 17 Fév 2026
Sometimes MATLAB fails to set breakpoints that are set in read-only files.
Robyn
Robyn le 8 Mai 2026 à 14:47
>> rehash toolboxcache
Thank you! This command fixed the issue for me.

Connectez-vous pour commenter.

Plus de réponses (1)

Image Analyst
Image Analyst le 10 Mai 2026 à 18:13

0 votes

Is the file SAVED? If it is, there will be no * next to the file name on the tab. If it is NOT saved, there will be a * next to the filename on the tab. If the file is not saved, then you will not be able to set a breakpoint. Save it and then you should be able to set a breakpoint. Test this out and you'll see I'm right.
For those who did "restoredefaultpath", typing that will (as long as this option is set) automatically save the file. When the focus leaves the editor window (at least with my settings), the file will automatically save. When you clicked in the command window to type that, focus left the editor which caused an automatic save. So then you can go back to the editor window and set a breakpoint. So it was not the function "restoredefaultpath" that fixed it, it was the automatic saving that fixed it.

Catégories

En savoir plus sur Environment and Settings dans Centre d'aide et File Exchange

Produits

Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by