Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: BinaryReadList

  • To: mathgroup at smc.vnet.net
  • Subject: [mg99621] Re: BinaryReadList
  • From: Bob F <deepyogurt at gmail.com>
  • Date: Sat, 9 May 2009 03:22:58 -0400 (EDT)
  • References: <gtudks$j19$1@smc.vnet.net>

On May 7, 4:37 am, Hannes Kessler <HannesKess... at hushmail.com> wrote:
> Hello,
>
> before Mathematica 7 the following command could be used to return the
> contents of a binary file as a list of records, each record being a
> nested list of a certain structure, for example
>
> BinaryReadList[file,{"Integer32", {"Real64", "Real64"}, "Integer32"}]
>
> Mathematica 7 complains:
>
> BinaryReadList::format {"Integer32", {"Real64", "Real64"},
> "Integer32"} is not a recognized binary format.
>
> I know there are other ways (see below one suggestion). But what is
> the purpose to eliminate useful existing functionality in new
> Mathematica revisions?
>
> Here is my workaround:
>
> format = {"Integer32", {"Real64", "Real64"}, "Integer32"};
> data = BinaryReadList[file, Flatten  @  format];
> formats = ConstantArray[format, Length[data]];
> positions = Position[formats, _String];
> rules = Inner[Rule, positions, Flatten[data], List];
> ReplacePart[formats, rules]
>
> Best regards,
> Hannes Kessler

I tried this on my Mac with 6.0.3 it worked fine and now with 7.0.1 I
get the same error as Hannes does. Seems like Wolfram took a step
backward as far as functionality goes.

I think this is a feature that Mathematica should have -- gives a lot
more flexibility in inputting data according to the what is needed by
the programmer.

-Bob


  • Prev by Date: Re: couple of questions about ListPlot3D
  • Next by Date: Re: copy and paste to other programs
  • Previous by thread: BinaryReadList
  • Next by thread: Odd ordering of results?