How can I repeat row and column extraction of a matrix until the end of the matrix is reached?
Ältere Kommentare anzeigen
I have a 1015x2 matrix of data and I'd like to extract the data in 145x2 incraments and add them to another matrix until I've reached the end of the original 1015x2 matrix. The next 145x2 extraction would then be added to 3rd and 4th columns of the new matrix. The resulting matrix should end up being of size 145x14. Thank you!
Akzeptierte Antwort
Weitere Antworten (1)
Voss
am 18 Sep. 2024
M = rand(1015,2);
incr = 145;
m = size(M,1)/incr;
n = size(M,2);
newM = reshape(permute(reshape(M,[],m,n),[1 3 2]),[],m*n);
Kategorien
Mehr zu Matrix Indexing finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!