From help-octave-request at bevo dot che dot wisc dot edu Wed Sep 2 18:49:18 1998 Subject: converting int 2 real and vice versa From: "John W. Eaton" To: Daniel Heiserer Cc: "help-octave at bevo dot che dot wisc dot edu" Date: Wed, 2 Sep 1998 18:49:45 -0500 (CDT) On 28-Aug-1998, Daniel Heiserer wrote: | I would like to convert integers to real and vice versa. | That looks strange for somebody working with octave which handles only | doubles. | The background is the following. | | I have a binary-file containing 4 byte words integers and floats. | I want to read it in with ONE fread command (!performance) into an | integer stream. | | Of course not all are integers, most of them are floats. In C you can | find that easily out by just looking at the value: I know that | everything which is bigger than a certain value and smaller than that | value represents a float. In Fortran I can share the stack via a COMMON | definition or in C I can do similar things with pointers or units. So I | can get the float value out of the integer value and vice versa. | Can I "transform" octaves data with a similar command? Do the float and integer values appear in a regular pattern, or can you only tell which is which ones are supposed to be integers by looking at the values? If they appear in regular patterns, you might be able to take advantage of the `skip' parameter for fread to read them efficiently. If you can only tell by looking at the values, I don't have a good solution for you. jwe