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!