From: greatguy on
Hi all,

When I open an image file with pic = fread(picfileid), I want pic to
have dimensions which match the height and width of the image. I
wonder what a smart way to do this would be in Matlab. I.e., how do I
transform [1 2 3 4 5 6] to [1 2; 3 4; 5 6]

Thanks
From: Oleg Komarov on
> have a look at reshape

reshape([1 2 3 4 5 6].',2,[]).'

Oleg
From: greatguy on
On 26 Juli, 10:47, "Oleg Komarov" <oleg.komarovRemove.t...(a)hotmail.it>
wrote:
> > have a look at reshape
>
> reshape([1 2 3 4 5 6].',2,[]).'
>
> Oleg

Thanks!
I new there would be a command for this.
From: Matt J on
greatguy <bjorn.tor.larsson(a)gmail.com> wrote in message <154e4399-d0a7-4b32-93a5-dc3545922e6e(a)g19g2000yqc.googlegroups.com>...
> Hi all,
>
> When I open an image file with pic = fread(picfileid), I want pic to
> have dimensions which match the height and width of the image. I
> wonder what a smart way to do this would be in Matlab. I.e., how do I
> transform [1 2 3 4 5 6] to [1 2; 3 4; 5 6]
========

reshape will work, as the others have mentioned. However, fread can be made to read in the data already shaped as you wish,

pic = fread(picfileid,TheDimensionsIWant);