Error: "Unable to read some of the variables due to unknown MAT-file error."

조회 수: 11 (최근 30일)
Will Q
Will Q 2019년 5월 21일
댓글: Walter Roberson 2019년 5월 21일
Hello, I have a 3.1 MB .mat file that contains activations from a hierarchical model, after reading a set of 504 images in double format. When I try to read the file in MATLAB, I receive the following error:
"Warning: Unable to read some of the variables due to unknown MAT-file error.
> In matfinfo (line 9)
In finfo (line 118)
In uiimport/gatherFilePreviewData (line 414)
In uiimport (line 244)
Error using load
Number of columns on line 2 of ASCII file
/Users/hsnsplazaresearch/Analysis/hmaxMatlab/output/exampleActivations.mat must be the same as previous lines.
Error in uiimport/runImportdata (line 465)
datastruct = load('-ascii', fileAbsolutePath);
Error in uiimport/gatherFilePreviewData (line 433)
[datastruct, textDelimiter, headerLines]= runImportdata(fileAbsolutePath, type);
Error in uiimport (line 244)
gatherFilePreviewData(fileAbsolutePath);"
I am highly confused, because the data is not ASCII. When I open in a text edtior (Atom), it appears like so:
"^[w<��H��UJT����r*IVQ��_TdDd�JJ!
�d�yp�=�=�풒�}޿�?�g|����ݓm�{�?��#���x7,^�"
The function was adapted from the HMAX model for machine vision, and the tarball can be found here: https://maxlab.neuro.georgetown.edu/hmax.html#code
The version is 2019a. Thank you so much for your time.
  댓글 수: 4
Will Q
Will Q 2019년 5월 21일
편집: Will Q 2019년 5월 21일
I have posted the file (exampleActivations.mat) here. I also posted a second .mat file (ExampleActivations2.mat) created using the exact same script (but using a smaller data set with different images), that looks like what my file should look like.
I think it is possible that the file gets corrupted near the end of the script, but am not certain. Thank you for taking the time to look at my issue!
Adam Danz
Adam Danz 2019년 5월 21일
편집: Adam Danz 2019년 5월 21일
When I drag-drop the first mat file into my workspace,
Error using load
Unable to read MAT-file C:\Users\name\Documents\MATLAB\exampleActivations.mat.
File might be corrupt.
When I load that file with the import tool
Error using load
Number of columns on line 2 of ASCII file C:\Users\name\Documents\MATLAB\exampleActivations.mat
must be the same as previous lines.
Error in uiimport/runImportdata (line 465)
datastruct = load('-ascii', fileAbsolutePath);
Error in uiimport/gatherFilePreviewData (line 433)
[datastruct, textDelimiter, headerLines]= runImportdata(fileAbsolutePath, type);
Error in uiimport (line 244)
gatherFilePreviewData(fileAbsolutePath);

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

답변 (1개)

Murugan C
Murugan C 2019년 5월 21일
Hi Will Q,
I can load 2nd (exampleActivations2) mat file data
%
load_mat = load('exampleActivations2.mat')
load_mat =
bestBands: {1x8 cell}
bestLocations: {1x8 cell}
c2: {1x8 cell}
extract_data = h.c2{1};
imshow(extract_data)
%
loadmatimg1.JPG
img1.JPG
But while loading 1'st mat file. I got error as like file may be corupted.
%
Error using load
Unable to read MAT-file E:\Sample MATLAB Program\MATLAB_Cent\exampleActivations.mat
File may be corrupt.
If possible to recreate a mat again.
/Murugan C

카테고리

Help CenterFile Exchange에서 Workspace Variables and MAT-Files에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by