Restore MATLAB functions e.g. openfig.m

조회 수: 4 (최근 30일)
fsgeek
fsgeek 2018년 9월 5일
댓글: fsgeek 2018년 9월 5일
Dear all,
I was playing around with openfig.m the other day. I kept a back-up copy of the file just in case something went wrong. However, I have managed to mess something up so that even with the back-up file reinstated, .fig files will no longer open and I get the error "Undefined variable "matlab" or class "matlab.graphics.internal.convertStringToCharArgs".
A general question: If the user somehow manages to "break" an M-file in the MATLAB root (like openfig.m), is there any way to restore the original M-files without reinstalling MATLAB? All of my project code is under version control, but this is not the case for the files under the root folder.
Best regards,
Louis
  댓글 수: 4
Stephen23
Stephen23 2018년 9월 5일
편집: Stephen23 2018년 9월 5일
Getting burnt once is usually a good way to learn to keep your hand out of the fire.
Not fiddling around with files in the MATLAB installation is the best solution. Instead simply copy them to your working directory, change their name/s, and then make any edits you want... no harm will be done.
Note that Windows (if you use it) might well have "previous versions" saved for that directory, so you could always try restoring from that.
fsgeek
fsgeek 2018년 9월 5일
Hi Stephen,
This is a very good tip. I've done this in the past and will double-down on my efforts.

댓글을 달려면 로그인하십시오.

답변 (1개)

Matt J
Matt J 2018년 9월 5일
편집: Matt J 2018년 9월 5일
After re-instating the backup, did you try restarting MATLAB? You could also try rehash() and/or
>> clear classes
  댓글 수: 1
fsgeek
fsgeek 2018년 9월 5일
Unfortunately this did not help. Actually, even after reinstalling MATLAB the issue still persists. I have written more information about the issue in Undefined variable "matlab" or class when opening MATLAB figure.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

제품


릴리스

R2014a

Community Treasure Hunt

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

Start Hunting!

Translated by