How to trim data from a double variable?
显示 更早的评论
Lets say we have a double variable 10x10 array, and entries in its 3rd row are (1,2,5,6,5,6,7,8,2,4), we need the values corresponding to data between 4 and 8 for this row, i.e. there are 7 valid entries in this row so we need the final output as a double variable 10x7 only. Thank you in advance!
let me clarify it with example: fullArray2D =
6 2 1 5 2 6 8 3 2 4
6 8 5 7 6 6 8 5 6 5
7 5 2 5 6 1 5 6 3 7
9 8 2 5 4 9 2 1 9 8
9 2 2 5 2 7 4 8 2 1
7 5 2 2 9 7 2 6 9 2
6 6 2 5 1 1 1 8 5 4
9 1 1 8 1 8 9 4 7 1
6 6 6 8 2 9 3 5 9 5
1 4 3 3 2 9 3 1 3 4
i want an output as following:
output=
6 2 5 2 8 3 4
6 8 7 6 8 5 5
*7 5 5 6 5 6 7*
9 8 5 4 2 1 8
9 2 5 2 4 8 1
7 5 2 9 2 6 2
6 6 5 1 1 8 4
9 1 8 1 9 4 1
6 6 8 2 3 5 5
1 4 3 2 3 1 4
hope this clarifies it.
3 个评论
Image Analyst
2013-3-31
How is the output 7 by 10 if you're only operating on row 3? Do you want to do all rows? If so, and there are different numbers of elements in each row that meet the criteria (e.g. 7 for one row but 3 for another row, etc.) then you'll have to use a cell array.
Umesh
2013-3-31
Image Analyst
2013-3-31
When you're operating on row 3 (a row vector of 10 elements), what does "the corresponding column" mean (corresponding to what?), and what does "extend it" mean?
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!