Hello,(adsbygoogle = window.adsbygoogle || []).push({});

I'm having a bit of trouble converting an 8 bit stream into a 10 bit one.

First i create intvalbin8, a Nx8 zero/one array where N is the byte length of the input data:

(6198 is the header offset factor)

Then i (hopefully) reshape it into a Nx10 one (intvalbin10) :Code (Text):j=1

do while (intvalout(i).gt.0)

intvalbin8(j,i-6198)=modulo(intvalout(i),2)

intvalout(i)=floor(real(intvalout(i))/2.)

j=j+1

end do

Transforming it into 10 bit integers with:Code (Text):

intvalbin10=reshape(intvalbin8,shape(intvalbin10))

In my case this is a column of values, corresponding to a 3712 x 464 array.Code (Text):

intvaldec10=0

do i=1,size(intvaldec10)

do j=1,10

intvaldec10(i)=intvaldec10(i)+intvalbin10(j,i)*2**(j-1)

end do

end do

The problem is that it somehow messes up the ordering od the indices.

When printing out only every fourth line, the image looks "fine".

(this is the most decent looking out of the four subsets)

)

This is the full, jumbled array

I have no clue whatsoever what is wrong here. I've tried transposing,flipping... the 8bit one while reshaping it, but to no avail.

Any help is much appreciated.

Kind regards,

Marko

**Physics Forums | Science Articles, Homework Help, Discussion**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Fortran 90, changing 8 bit stream into a 10 bit one

**Physics Forums | Science Articles, Homework Help, Discussion**