[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: save -mat-binary
From: |
cctsim |
Subject: |
Re: save -mat-binary |
Date: |
Sat, 14 Jun 2003 23:40:57 +0100 (BST) |
On Saturday 14 June 2003 22:43, you wrote:
> On 14-Jun-2003, cctsim <address@hidden> wrote:
> | I have files containing 1's and -1's
> | e.g.
> |
> | >> C=[1 1 -1];
> | >> save -mat-binary test.mat C
> |
> | A colleague using matlab (6.1) needs to load these files.
> |
> | However, If we try to open the files in matlab we get the following:
> | >> load test.mat
> | >> C
> |
> | C =
> |
> | 1.0e-316 *
> |
> | 0.8257 0 0
> |
> | Saving the file using
> |
> | >> save -mat4-binary test.mat C
> |
> | works fine.
> |
> | I use octave 2.1.49.
>
> Can you please try the following patch and let me know if it solves
> the problem?
>
> Thanks,
>
> jwe
>
>
> src/ChangeLog:
>
> 2003-06-14 John W. Eaton <address@hidden>
>
> * load-save.cc (get_save_type): Avoid all save types other than
> LS_DOUBLE to avoid apparent Matlab bugs.
>
>
> Index: src/load-save.cc
> ===================================================================
> RCS file: /usr/local/cvsroot/octave/src/load-save.cc,v
> retrieving revision 1.169
> diff -u -r1.169 load-save.cc
> --- src/load-save.cc 28 May 2003 18:24:42 -0000 1.169
> +++ src/load-save.cc 14 Jun 2003 21:42:22 -0000
> @@ -3507,7 +3507,10 @@
>
> // Matlab doesn't seem to load the UINT32 type correctly, so let's
> // avoid it (and the other unsigned types, even though they may not
> - // have the same problem.
> + // have the same problem. And apparently, there are problems with
> + // other smaller types as well. If we avoid them all, then maybe we
> + // will avoid problems. Unfortunately, we won't be able to save
> + // space...
>
> // if (max_val < 256 && min_val > -1)
> // st = LS_U_CHAR;
> @@ -3515,14 +3518,12 @@
> // st = LS_U_SHORT;
> // else if (max_val < 4294967295UL && min_val > -1)
> // st = LS_U_INT;
> - // else
> -
> - if (max_val < 128 && min_val >= -128)
> - st = LS_CHAR;
> - else if (max_val < 32768 && min_val >= -32768)
> - st = LS_SHORT;
> - else if (max_val <= 2147483647L && min_val >= -2147483647L)
> - st = LS_INT;
> + // else if (max_val < 128 && min_val >= -128)
> + // st = LS_CHAR;
> + // else if (max_val < 32768 && min_val >= -32768)
> + // st = LS_SHORT;
> + // else if (max_val <= 2147483647L && min_val >= -2147483647L)
> + // st = LS_INT;
>
> return st;
> }
Problem solved, it is working absolutely fine now.
Thank you very much !
Regards
cctsim
__________________________________________________
Yahoo! Plus - For a better Internet experience
http://uk.promotions.yahoo.com/yplus/yoffer.html
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------