Problem Loading a Design Matrix File

1 次查看(过去 30 天)
Paige Oden
Paige Oden 2019-6-4
编辑: dpb 2019-6-4
I am attempting to load a design matrix titled R_Hipp_all.mat into Matlab. However, all I'm getting are errors. If I click on the file, I get the following error:
Error using load
Number of columns on line 3 of ASCII file /Users/paigeoden/data/R_Hipp_all.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);
If I try to open it within Matlab, I recieve this error:
load('R_Hipp_all.mat')
Error using load
Unable to read MAT-file /Users/paigeoden/data/R_Hipp_all.mat. Not a binary MAT-file.
Try load -ASCII to read as text.
Along with the bottom left box saying "Error loading the selected Matlab file." Does anyone know why this might be happening?

回答(1 个)

dpb
dpb 2019-6-4
The first error message tells you precisely why it's happening -- the third line of the file doesn't have the same number of values/delimiters as do the previous two lines. load -ascii can only handle regular files.
Whoever named the file with a .mat extension erred in doing so as it leads to expectations of what file content will be that aren't met with this particular file.
We would have to see the file to be able to have any more suggestions regarding how to read it specifically; in general there is textscan for fscanf which can read most any file structure but have to be coached on how to do so if the data isn't totally regular in pattern.
  4 个评论
Paige Oden
Paige Oden 2019-6-4
Thank you! This is probably a silly question, but how were you able to look at the file like that?
dpb
dpb 2019-6-4
Well, I did that by simply clicking on your link and "open in new tab" -- but just use a text editor like any other text file...

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

产品


版本

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by