Prev: LARGE array indexing
Next: solutions books
From: Claire on 28 Jul 2010 01:59 I have a 4D dataset comprised of latitude, longitude, depth and time for the Southern Ocean. I have analysed my dataset in order to determine the locations of different water masses within the original dataset based on temperature and salinity properties. What I now have is a 4D matrix 'AABWyn1', which has 0 or 1 values within the 4D grid depending on if the grid point meets my criteria. What I want to do is find the number of '1's in my 4D grid. I have tried using the 'find' and 'sum' commands, but these don't seem to give me what I want - they seem to not work in 4D. Secondly, I can visualise in my head my 3D grid for each time period as a series of cubes, within latitude, longitude and depth coordinates. What I want to do is find the volume of these cubes that have a '1'. I.e. I want to sum up the number of cubes that have the value '1' at all their vertices in order to determine the volume of the water mass for each time period. I can then use the scales of each of the 3D axes to work out my real volumes. I have no idea how to do either of these things and I would really appreciate any help anyone can offer. Thanks in advance, Claire
From: Matt J on 28 Jul 2010 02:17 "Claire " <claire.davis(a)students.mq.edu.au> wrote in message <i2ogv9$n1n$1(a)fred.mathworks.com>... > I have a 4D dataset comprised of latitude, longitude, depth and time for the Southern Ocean. I have analysed my dataset in order to determine the locations of different water masses within the original dataset based on temperature and salinity properties. > > What I now have is a 4D matrix 'AABWyn1', which has 0 or 1 values within the 4D grid depending on if the grid point meets my criteria. > > What I want to do is find the number of '1's in my 4D grid. I have tried using the 'find' and 'sum' commands, but these don't seem to give me what I want - they seem to not work in 4D. ================ Doing either nnz(AABWyn1) or sum(AABWyn1(:)) should work for this part. > Secondly, I can visualise in my head my 3D grid for each time period as a series of cubes, within latitude, longitude and depth coordinates. What I want to do is find the volume of these cubes that have a '1'. I.e. I want to sum up the number of cubes that have the value '1' at all their vertices in order to determine the volume of the water mass for each time period. I can then use the scales of each of the 3D axes to work out my real volumes. ============ Are you sure you mean all their "vertices"? You mean there are 1s at the corners of the cube, but nowhere else? If you have the image processing toolbox, bwconncomp and regionprops should help.
|
Pages: 1 Prev: LARGE array indexing Next: solutions books |