How to cut a matrix?

4 次查看(过去 30 天)
Daniel Tanner
Daniel Tanner 2020-5-15
I have a matrix that is 35000-by-11. The first column specifies a depth and the next ten specify data at that certain depth. I am only interested in data between the depths of 241 and 285. How do I identify which elements in the column are in those regions and essentially create a new matrix with just the region of interest? Sorry if this is simple as I am still new to MatLab!
Thanks!

采纳的回答

Ameer Hamza
Ameer Hamza 2020-5-15
编辑:Ameer Hamza 2020-5-15
Something like this
M % matrix of dimensions 35000-by-11
depths = M(:,1);
idx = (241 < depths) & (depths < 285)
M_new = M(idx, :)
M_new is the required matrix in which the element in the first column is only in range (241, 285).

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Multidimensional Arrays 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by