m file code sometimes loss a "end" and corruput the file on hard disc.
조회 수: 1 (최근 30일)
이전 댓글 표시
I encountered some very rare error (~1 occurance/year).
The error is that when I run matlab project/functions, very rarely the code is corrupted, one time it is a variable name that was changed at somewhere which cause an error(The old variable name is updated, and run for many times OK, then suddenly error take place one day saying that a variable is not defined), the other time is the lossing of a "end" statement in middle, so the code jump to the FUNCTION END and cause error of no argout.
This is strange since I have not edit this code for many months but still using it everyday. But it just happened just now.
I thought it might be caused by too heavy usage of my xps13 laptop for past 7 years. I used Matlab too heavily to automate my enumourous works and my laptop seems to be at the final stage of its life.
Not sure if someone else also encountered this kind of problem.
댓글 수: 1
Rik
2022년 3월 23일
I don't see what would make this question not appropriate. Can you explain why you think it is?
채택된 답변
Jan
2022년 3월 23일
편집: Jan
2022년 3월 23일
It is extremely unlikely, that the 3 characters "end" vanish inside a text file, while the rest of the computer runs without a crash. Such behaviour would be a sign of pure magic.
This effect happens frequently and you find many similar questions. In all (!) cases, there have been deterministiv reasons, which the user was not aware of. Of course, this does not allow to prove, that this is true in your case alos, but it is a very strong evidence.
Compare the changed files with your backups. Check, when these files have been changed or if you have several files with the same name and are running another version, because the current directory is the folder, which contains the other M file.
If the 3 characters "end" would be changed to some strange uni-code characters, a failing SSD or hard disk would be more plausible. But a clean vanishing is too unlikely.
Use a chkdsk (assuming you work with Windows) and a tool like CrystalDiskInfo to check the integrity of the disk. But have in mind, that there is another important source of problems, which you did not consider yet. A version history, which contains all changes of each file, is required for a reliable programming.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!