Matlab script generating corrupted workspace
이전 댓글 표시
Hello, novice Matlab user here so please forgive any obvious errors. I have written a script that analyzes a significant amount of data. The script does what I want it to do, generating a Matlab workspace with a combination of tables, doubles, and timetables. However, when I save this workspace and try to reload it, I get an error. Some of the errors I've gotten have been:
Error using load
Cannot read file D:\test2.mat.
and
I've gone through the script section by section, saving and loading the workspaces, and have come upon the line that seems to be causing this (when I save and load its workspace, the workspace says it has loaded but either nothing comes up or the error: Error using load. Unable to read MAT-file D:\chunk11t2.mat. File might be corrupt). The line itself is: fulldayr=fullday(room==1,:); where I essentially have a logic array (room) and I am trying to pull out all the columns of the rows corresponding to when room is equal to 1 to make a new table.
Does anyone have any thoughts on this? I will need to save the workspaces I am generating, there is no way around that. Perhaps an alternative code to the line I am using? Thank you in advance!
채택된 답변
추가 답변 (1개)
Walter Roberson
2022년 6월 27일
0 개 추천
I wonder if you are accidentally saving code to the mat file?
In any case: do not save() a mat file directly to OneDrive especially (and treat other cloud storage destinations with suspicion.) Save to a local file on your hard drive, and copy the result to OneDrive
댓글 수: 2
MARTINA ROGERS
2022년 6월 27일
Walter Roberson
2022년 6월 29일
It does not make sense to me that you would get an error message about unable to read the mat file on a line that appears to be indexing a variable.
카테고리
도움말 센터 및 File Exchange에서 Entering Commands에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!