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!