From: Mike on
So this might be quite simple and I just am having a brain fart...

My issue is that I am reading in data files to a 3dimensional array where I use hdrload.m to do this, First I load the header and data both as a 2D array then add them to the 3D array. However, some of my header files are dimensions:
187 x 84
and others are
186 x 84
So I am having issues combining these arrays to my 3D array since dimensions are different. So I figured an "easy" solution to this would be just changing the dimension of the 186 x 84 array to 187 x 84. However, I can not seem to find a way of doing this. Any suggestions?

Thank you!
From: Walter Roberson on
Mike wrote:
> So this might be quite simple and I just am having a brain fart...
> My issue is that I am reading in data files to a 3dimensional array
> where I use hdrload.m to do this, First I load the header and data both
> as a 2D array then add them to the 3D array. However, some of my header
> files are dimensions:
> 187 x 84
> and others are
> 186 x 84
> So I am having issues combining these arrays to my 3D array since
> dimensions are different. So I figured an "easy" solution to this would
> be just changing the dimension of the 186 x 84 array to 187 x 84.
> However, I can not seem to find a way of doing this. Any suggestions?

if size(TheArray,1) < 187; TheArray(187,:) = 0; end
From: Mike on
Walter Roberson <roberson(a)hushmail.com> wrote in message <4sj2o.39146$3%3.20335(a)newsfe23.iad>...
> Mike wrote:
> > So this might be quite simple and I just am having a brain fart...
> > My issue is that I am reading in data files to a 3dimensional array
> > where I use hdrload.m to do this, First I load the header and data both
> > as a 2D array then add them to the 3D array. However, some of my header
> > files are dimensions:
> > 187 x 84
> > and others are
> > 186 x 84
> > So I am having issues combining these arrays to my 3D array since
> > dimensions are different. So I figured an "easy" solution to this would
> > be just changing the dimension of the 186 x 84 array to 187 x 84.
> > However, I can not seem to find a way of doing this. Any suggestions?
>
> if size(TheArray,1) < 187; TheArray(187,:) = 0; end

haha thanks, I knew it'd be simple. silly me :)
From: Andy on
You may want to set the padding values to NaN rather than 0 to remind yourself later that these values don't represent real data.
From: Mike on
"Andy " <myfakeemailaddress(a)gmail.com> wrote in message <i2ck00$18o$1(a)fred.mathworks.com>...
> You may want to set the padding values to NaN rather than 0 to remind yourself later that these values don't represent real data.

yeah, I added a space at the end. Since it's the header files giving me issues, so the space won't be noticed.