Re: File



am <amelie.quinet@xxxxxxxxxxxxxx> writes:

Titus Edelhofer wrote:

"am" <amelie.quinet@xxxxxxxxxxxxxx> schrieb im Newsbeitrag
news:ef348d8.-1@xxxxxxxxxxxxxxxxxxx

I m afraid this question may be very stupid.

But I want to put in a file (fid=fopen('file','wb');
fwrite(array,' ???'); fclose(fid)), an array which contains
integers > 65000 and floating numbers.

So, of course I can not use 'bitN' because floating point numbers
are cut, and I can't use 'double' because integers > 255 are
cut...

I know this question may be stupid ... but is there a solution

Hi Amelie,
what do you mean by "integers>255 are cut"? For the first
31 bits (values around 2e+9) doubles can be used to represent
integers exactly... ?

yes, you're right.
But in fact, I need to use 'bitN' and not double. So the problem is
how to keep floating values.

Where do these requirements come from? Someone says "You must type
'bitN' for a MATLAB format" and also "You must store double precision
data types"? Obviously you can't do both. So you have to be more
specific about what the restrictions really are. Can you scale the
double precision values into 32-bit fixed point? Can you mix writes
the file, so some elements are stored as doubles and others as ints?
Is is for compatibility with some other software? Etc, etc, etc.


--
Peter Boettcher <boettcher@xxxxxxxxxx>
MIT Lincoln Laboratory
MATLAB FAQ: http://www.mit.edu/~pwb/cssm/
.



Relevant Pages

  • Re: File
    ... 31 bits doubles can be used to represent ... I m afraid this question may be very stupid. ... of course I can not use 'bitN' because floating point ... I need to use 'bitN' and not double. ...
    (comp.soft-sys.matlab)
  • Re: Namespaces in assembly language
    ... > stored in floating point format): ... Okey. ... I was just stupid, because I have just to little experience with ...
    (alt.lang.asm)
  • Re: __TIME_MIN/__TIME_MAX
    ... so do I :-) MIN/MAX values won't work for removing some (IMHO ... stupid) warnings emitted by GCC. ... > would need to be maintained forever, and works even better for floating ...
    (freebsd-arch)
  • Re: File
    ... 31 bits doubles can be used to represent ... I m afraid this question may be very stupid. ... of course I can not use 'bitN' because floating point numbers are ... Amelie ...
    (comp.soft-sys.matlab)