Recover a .mat file

조회 수: 5 (최근 30일)
New
New 2011년 4월 12일
답변: Vanusha Vicknesvaran 2020년 11월 28일
Hi, I saved yesterday my workspace in .mat file. Tried to open the file today and got the following: ??? Error using ==> load Number of columns on line 1 of ASCII file...must be the same as previous lines.
Error in ==> importdata at 195 out = load('-ascii',FileName);
Error in ==> uiimport>runImportdata at 432 [datastruct, OTextDelimiter, OHeaderLines] = ...
Error in ==> uiimport>gatherFilePreviewData at 375 [datastruct, textDelimiter, headerLines]= runImportdata(fileAbsolutePath, type);
Error in ==> uiimport at 205 [ctorPreviewText, ctorHeaderLines, ctorDelim] = ...
What can I do to recover the file?
  댓글 수: 1
Hatem
Hatem 2011년 10월 19일
Any solutions? I just got the same error!
Thx.

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

답변 (6개)

Andreas Goser
Andreas Goser 2011년 4월 12일
This is a confusing error message. I would expect this message when using an ASCII file, not a binary MAT file. In order to help you, the following information can be helpful:
  1. MathWorks release and operating system
  2. Exact command you try to load the file
  3. Exact command you used to write the file (copy from yesterday's history
  4. Can you open the file in an editor? What are the first 2 lines? By that you find whether this is a type of MAT file or ASCII
  댓글 수: 1
New
New 2011년 4월 12일
Hi,
I use Matlab R2010b. I tried to double click on the mat file on the current folder display. I used the command save('name.mat') to save my entire workspace. I can open the file with an editor:
MATLAB 5.0 MAT-file, Platform: PCWIN64, Created on: Sun Apr 10 23:31:10 2011

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


Walter Roberson
Walter Roberson 2011년 4월 12일
Why is the traceback showing that you used uiimport() when you indicate that you were trying to load a saved workspace?

Jan
Jan 2011년 4월 12일
Did you try to use the LOAD command instead of UIIMPORT?
load(FileName, '-mat')
  댓글 수: 1
New
New 2011년 4월 12일
Yes, this is what I get:
??? Error using ==> load
Unable to read MAT-file (--My path here-)
File may be corrupt.

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


Hatem
Hatem 2011년 10월 19일
Hi all,
I just got the same error, but the .mat file is large ( > 100Mbytes ). Sometimes after repeated trials is loads normally, but then gives this error once more later.
Any solutions anyone?
Cheers.

Bijan Nouri
Bijan Nouri 2017년 6월 21일
I know its late but I just had the same issue. In my case i'm writing permanently a matrix which adds every 30 s a new row (for the last 6 weeks). I'm not sure what went wrong during the writing process but since yesterday the writing process fails and i get the following error:
Number of columns on line 2 of ASCII file myFile.mat must be the same as previous lines.
Well i could open my file via:
X = matfile('yourFileName');
In the end I lost the last 600 rows of my file, but i could store all previous data in a new mat file.

Vanusha Vicknesvaran
Vanusha Vicknesvaran 2020년 11월 28일
Write a MATLAB code to estimate and plot the joint PMF from two .mat files?
Does anyone know how to do this?

카테고리

Help CenterFile Exchange에서 Text Files에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by