|
|
changing size of array
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!
|
|
0
|
|
|
|
Reply
|
Mike
|
7/23/2010 4:24:04 PM |
|
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
|
|
0
|
|
|
|
Reply
|
Walter
|
7/23/2010 4:29:52 PM
|
|
Walter Roberson <roberson@hushmail.com> wrote in message <4sj2o.39146$3%3.20335@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 :)
|
|
0
|
|
|
|
Reply
|
Mike
|
7/23/2010 4:40:08 PM
|
|
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.
|
|
0
|
|
|
|
Reply
|
Andy
|
7/23/2010 5:37:04 PM
|
|
"Andy " <myfakeemailaddress@gmail.com> wrote in message <i2ck00$18o$1@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.
|
|
0
|
|
|
|
Reply
|
Mike
|
7/23/2010 5:50:34 PM
|
|
|
4 Replies
313 Views
(page loaded in 0.027 seconds)
|
|
|
|
|
|
|
|
|