Creating new variable using different row and column chunks from a matrix
조회 수: 1 (최근 30일)
이전 댓글 표시
My data (D) is a '29x46 double' matrix.
I want to sort and create six columns variable(Training1_T) usign the different chunks of a data.
For explaination:
I'm using the following code which is error-free but is not generating the output file I desire
Training1_T= D ([1:14,17:21],[15:29,32:36]);
where from the D matrix, I want matlab to pick two chunks of the data. In the first chunk, I want matlab to use the 1-14th rows and the 17-21st column. For the second chunk, i want the 15-29th rows and 32-36th columns. Finally, I want the output file to have 5 columns only where the second chunk starts from the next row in the new output variable (Training1_T).
The current output is a 19x20 double file but I want it to give me 29x5 output
Please Help. Thank you in advance
댓글 수: 0
답변 (1개)
Fangjun Jiang
2023년 9월 25일
편집: Fangjun Jiang
2023년 9월 25일
D=rand(29,46);
Training1_T= [D(1:14,17:21);D(15:29,32:36)]
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!