Discussion:
open mat files on Linux and Windows
(too old to reply)
flowdimow
2006-09-07 10:30:59 UTC
Permalink
Hello People,

I created a mat file in Matlab running on a Linux system. Now I want to
open it with a Windows computer, but it doesn't work. I receive the
message 'file my be corrupt'.
Does anybody know how to handle this problem?

Greetings, Flo
Konstantin Miller
2006-09-07 14:49:06 UTC
Permalink
Post by flowdimow
Hello People,
I created a mat file in Matlab running on a Linux system. Now I want to
open it with a Windows computer, but it doesn't work. I receive the
message 'file my be corrupt'.
Does anybody know how to handle this problem?
Greetings, Flo
Hi Flo!

If it is the thing with the new line characters then this perl scripts will
help you

dos2unix.pl:

#!/usr/bin/perl -pi
s/\r\n/\n/;


unix2dos.pl:

#!/usr/bin/perl -pi
s/\n/\r\n/;

Just run unix2dos.pl on your mat file.
I didn't write them myself but found somewhere in the internet.

Konstantin
XConv
2006-09-22 01:05:24 UTC
Permalink
Try the online dos2unix service.
Goto http://www.xconv.com
Select a file
Click "Convert"
Download the converted file.
It's easy.
Post by Konstantin Miller
Post by flowdimow
Hello People,
I created a mat file in Matlab running on a Linux system. Now I want to
open it with a Windows computer, but it doesn't work. I receive the
message 'file my be corrupt'.
Does anybody know how to handle this problem?
Greetings, Flo
Hi Flo!
If it is the thing with the new line characters then this perl scripts will
help you
#!/usr/bin/perl -pi
s/\r\n/\n/;
#!/usr/bin/perl -pi
s/\n/\r\n/;
Just run unix2dos.pl on your mat file.
I didn't write them myself but found somewhere in the internet.
Konstantin
flowdimow
2006-11-13 13:51:24 UTC
Permalink
Post by Konstantin Miller
Post by flowdimow
Hello People,
I created a mat file in Matlab running on a Linux system. Now I want to
open it with a Windows computer, but it doesn't work. I receive the
message 'file my be corrupt'.
Does anybody know how to handle this problem?
Greetings, Flo
Hi Flo!
If it is the thing with the new line characters then this perl scripts will
help you
#!/usr/bin/perl -pi
s/\r\n/\n/;
#!/usr/bin/perl -pi
s/\n/\r\n/;
Just run unix2dos.pl on your mat file.
I didn't write them myself but found somewhere in the internet.
Konstantin
unfortunately it doesn't work. Any other idea?


Greetings, Flo
Dan Hensley
2006-11-13 15:23:57 UTC
Permalink
Post by Konstantin Miller
Post by flowdimow
Hello People,
I created a mat file in Matlab running on a Linux system. Now I want to
open it with a Windows computer, but it doesn't work. I receive the
message 'file my be corrupt'.
Does anybody know how to handle this problem?
Greetings, Flo
Hi Flo!
If it is the thing with the new line characters then this perl scripts will
help you
A MAT file is a binary file, so this utility will not work.

Dan
Christopher Hulbert
2006-11-13 15:26:45 UTC
Permalink
Post by Dan Hensley
Post by Konstantin Miller
Post by flowdimow
Hello People,
I created a mat file in Matlab running on a Linux system. Now I want to
open it with a Windows computer, but it doesn't work. I receive the
message 'file my be corrupt'.
Does anybody know how to handle this problem?
Greetings, Flo
Hi Flo!
If it is the thing with the new line characters then this perl scripts will
help you
A MAT file is a binary file, so this utility will not work.
Dan
What are the Matlab versions on Linux and Windows. Can the file be reopened on
Linux? Did you ftp it in ascii mode (i.e. how did you transfer from Linux to
Windows)

Dan Hensley
2006-09-22 03:30:52 UTC
Permalink
Post by flowdimow
Hello People,
I created a mat file in Matlab running on a Linux system. Now I want to
open it with a Windows computer, but it doesn't work. I receive the
message 'file my be corrupt'.
Does anybody know how to handle this problem?
Greetings, Flo
How did you transfer the file? ftp, ascii? If so, that's why it won't
work. If you run a dos2unix on the file though, you will very likely
corrupt it beyond recognition. A .mat file is a binary file, and these
utilities are designed for text files.

Dan
French Caro
2006-09-22 06:53:41 UTC
Permalink
Hi,

I remember to have had that sort of problem by doing this :
using tar on unix to tar all my m and mat-files
using WinZip on windows to unzip
=> this corrupt the MAT-File.
You have to use the same tool to zip and unzip.
I suspect that using other things like ftp or whatever may have the
same side effects.
Caroline
Loading...