Hi everyone, I'm going to update just in case anyone else runs into this issue. I was able to save and load the workspace if I used the save FileName -v7.3 function at the end of my script. Thanks for everyone's help.
Matlab script generating corrupted workspace
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
MARTINA ROGERS
il 27 Giu 2022
Risposto: MARTINA ROGERS
il 29 Giu 2022
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!
0 Commenti
Risposta accettata
Più risposte (1)
Walter Roberson
il 27 Giu 2022
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 Commenti
Walter Roberson
il 29 Giu 2022
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.
Vedere anche
Categorie
Scopri di più su Tables in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!