필터 지우기
필터 지우기

Error reading .mat file

조회 수: 2 (최근 30일)
Fiona Gong
Fiona Gong 2019년 9월 27일
댓글: Fiona Gong 2019년 9월 28일
Hi, I have a .mat file which is produced by MIPAV and for some reason matlab cannot load it, here's the error message. Just wondering if anyone seen this before?
Number of columns on line 2 of ASCII file /Users/fiona/Desktop/_801_smask.mat
must be the same as previous lines.
Error in uiimport/runImportdata (line 467)
datastruct = load('-ascii', fileAbsolutePath);
Error in uiimport/gatherFilePreviewData (line 435)
[datastruct, textDelimiter, headerLines]= runImportdata(fileAbsolutePath,
type);
Error in uiimport (line 245)
gatherFilePreviewData(fileAbsolutePath);
  댓글 수: 2
Guillaume
Guillaume 2019년 9월 27일
Can we have an example of the file?
Using readtable or readmatrix (if your version is new enough) would allow more flexibility than using load which is probably the worse way of reading text files.
Stephen23
Stephen23 2019년 9월 27일
Fiona Gong's "Answer" moved here:
Example attached. I have matlab 2018a so cannot use readmatrix. Readtable returns an error too 'Unable to open file '_801_smask.txt'.'

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

채택된 답변

Stephen23
Stephen23 2019년 9월 27일
편집: Stephen23 2019년 9월 27일
MIPAV wrote a dud file.
Open that file in any reliable text editor, and you will find that it contains the text "MIPAV is writing a .mat file" and then the null character repeated 1247525 times, along with a few other assorted characters for variety:
It does not look much like a valid .mat file.
  댓글 수: 1
Fiona Gong
Fiona Gong 2019년 9월 28일
Thanks Stephen, it's bizzare how MIPAV makes .mat files....

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

추가 답변 (0개)

카테고리

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