How to read Unreadable Files!

Hi Guys! I have trouble plotting .mat format files. The error message is "Unable to read MAT-file. Not a binary MAT-file. Try load -ASCII to read as text". Is there anyone can help why these files are unreadable and How they can be fixed? knowing, the files are Simulink outputs!
Thanks in advance,

6 commentaires

Walter Roberson
Walter Roberson le 19 Déc 2017
Can you attach one of the files?
Omar
Omar le 20 Déc 2017
Thank you Walter for your reply. I couldn't upload the file because the file is huge and I couldn't compress it to 5MB as it the maximum size someone can upload here. Is there a way to upload the file?
Okay, then for now please show
fid = fopen('NameOfMatFile.mat', 'r');
first256 = fread(fid, [1 256], '*uint8');
close(fid);
first256
char(first256)
Omar
Omar le 20 Déc 2017
Walter, I ran the code you just posted and here is the output file.
Walter Roberson
Walter Roberson le 20 Déc 2017
That looks like it might be a real .mat file.
Is it possible that you are trying to load the file with a version of MATLAB older than R2006b ?
You can post the file on Google Drive or Dropbox for people to examine
Omar
Omar le 20 Déc 2017
No actually I use Matlab 2017a.

Connectez-vous pour commenter.

Réponses (1)

Jan
Jan le 20 Déc 2017
Modifié(e) : Jan le 20 Déc 2017

0 votes

I see 2 options:
  1. This is not the file you try to load. Maybe you are working in a different folder than you expect.
  2. The file is really damaged. Then it will be impossible to open it. This is the definition of "unreadable". Do you have a backup of the file or can you re-create it?
What do you see if you run the code from Walter's code?

4 commentaires

Omar
Omar le 26 Déc 2017
I am sorry Jan for getting back to you too late... I think I am working on the same folder that contains these files. I am attaching one of these files here if you would take a look. again the error message is "Unable to read MAT-file C:\Users\...\disp_20_unct_ha_la01.mat. Not a binary MAT-file. Try load -ASCII to read as text. "
Jan
Jan le 26 Déc 2017
The file is damaged. load cannot read it. The header claims, that it has a HDF5 format:
MATLAB 7.3 MAT-file, Platform: GLNXA64,
Created on: Fri Dec 22 20:40:57 2017 HDF5 schema 1.00 .
But hdf5info cannot read it also. It seems like the file is damaged. How do you create these files?
Omar
Omar le 26 Déc 2017
these files are outputs of Simulink model using "TO File" block.
Omar
Omar le 26 Déc 2017
I should also point out that I ran these codes on the supercomputer in my school. when I use my own pc no problem at all. knowing that the supercomputer unit also use MatlabR2017a

Connectez-vous pour commenter.

Catégories

En savoir plus sur Large Files and Big Data dans Centre d'aide et File Exchange

Question posée :

le 19 Déc 2017

Commenté :

le 26 Déc 2017

Community Treasure Hunt

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

Start Hunting!

Translated by