How to extract a diagonal band of data from a square matrix, to reduce array size?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Robert
el 18 de Jul. de 2017
Editada: David Goodmanson
el 18 de Jul. de 2017
Hi,
I am looking to extract data for the region Latitudes (North=29 and South= 22.5) and Longitudes (West= -179 and East= -160.5), which is the area where the Northwest Hawaiian Islands are located. However, as the data comes at 1km pixel resolution, I end with a Matrix=(650,1500,time), where time is 6000, so having trouble in Matlab to produce this matrix.
As the islands are distributed in a diagonal position (within this latitude and longitude box), I am wondering how could I extract just the diagonal portion, or data close to the islands in this case, and skip extracting the other data (southwest and northwest corners) to reduce the size of my final matrix. All this to be able later to analyze this data in Matlab.
Suggestions are appreciated! Thanks!
1 comentario
David Goodmanson
el 18 de Jul. de 2017
Editada: David Goodmanson
el 18 de Jul. de 2017
Hi Robert, lots of possibilities here. First, if your data is in floating point, would there be enough resolution if you converted it with a linear transformation to uint16 (0-65535), for example? That would be worth a factor of 4. If you are only interested in the islands themselves, it would not be hard to extract equal-sized blocks and concatenate them to make a 4x3 array of blocks or similar, like stamps. Or stack them in the third dimension of a 3d array. Time would be the next dimension after that.
Respuesta aceptada
Walter Roberson
el 18 de Jul. de 2017
See https://www.mathworks.com/matlabcentral/answers/348465-hello-been-trying-to-extract-array-from-a-big-matrix-so-because-of-that-taken-magic-5-but-issue-is#comment_468693 and https://www.mathworks.com/matlabcentral/answers/348500-extracting-last-non-nan-200-columns-from-matrix-with-varying-number-of-nans-ending-the-rows#answer_273971 where I show how to extract different columns for each row.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Operating on Diagonal Matrices en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!