Creating new variable using different row and column chunks from a matrix
1 view (last 30 days)
Show older comments
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 Comments
Answers (1)
Fangjun Jiang
on 25 Sep 2023
Edited: Fangjun Jiang
on 25 Sep 2023
D=rand(29,46);
Training1_T= [D(1:14,17:21);D(15:29,32:36)]
0 Comments
See Also
Categories
Find more on Shifting and Sorting Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!