From: greatguy on 26 Jul 2010 04:16 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 26 Jul 2010 04:47 > have a look at reshape reshape([1 2 3 4 5 6].',2,[]).' Oleg
From: greatguy on 26 Jul 2010 07:21 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 26 Jul 2010 11:15 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);
|
Pages: 1 Prev: Gaussian Distribution Next: one-sided 2D inverse fourier transform |