[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: compex vector in 'C' -> complex vector in 'octave'
From: |
Sergei Steshenko |
Subject: |
Re: compex vector in 'C' -> complex vector in 'octave' |
Date: |
Thu, 24 Apr 2008 12:20:16 -0700 (PDT) |
--- "James Sherman Jr." <address@hidden> wrote:
> I'm not sure how "elegant" it is, but I'd just do
>
> y = x(1:2:end) + x(2:2:end)*i;
>
> The best solution is probably just put this in your own
> "read_complex_vector" function and just use that whenever you want to
> read in that file format.
>
> Hope this helps.
>
> On Thu, Apr 24, 2008 at 2:14 PM, Sergei Steshenko <address@hidden> wrote:
> > Hello All,
> >
> > supposed I have a complex vector generated by a 'C' program and dumped in
> > binary form into a
> file
> > using 'fwrite'.
> >
> > So, the data will put into the file this way:
> >
> > re[0], im[0], re[1], im[1], ... re[N-1], im[N-1]
> >
> > where N is number of elements in the vector.
> >
> > I can load the vector into octave using 'fread', but, I quess, it will
> > look like vector
> > of real numbers.
> >
> > I can take data at indexes 1, 3, 5... (the real parts) and at indexes 2,
> > 4, 6 ... (the
> imaginary
> > parts) and "reconstitute" the vector, but maybe there is a handy function
> > which already does
> > this ?
> >
> > I read
> >
> >
>
http://www.gnu.org/software/octave/doc/interpreter/Rearranging-Matrices.html#Rearranging-Matrices
> >
> > but could come up with anything more elegant than the straightforward
> > odd-even indexes
> solution.
> >
> > Thanks,
> > Sergei.
> >
> > Applications From Scratch: http://appsfromscratch.berlios.de/
> >
> >
> >
> >
> > ____________________________________________________________________________________
> > Be a better friend, newshound, and
> > know-it-all with Yahoo! Mobile. Try it now.
> http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
> > _______________________________________________
> > Help-octave mailing list
> > address@hidden
> > https://www.cae.wisc.edu/mailman/listinfo/help-octave
> >
>
Thanks,
that's the straightforward solution I was talking about.
Regards,
Sergei.
Applications From Scratch: http://appsfromscratch.berlios.de/
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now.
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ