matrix - How two reshape two columns into multiple columns in matlab -
does know how can reshape these 2 columns:
1 1 1 1 1 1 379 346 352 363 330 371 309 379 291 391 271 402 268 403 1 1 1 1 406 318 379 334 351 351 329 359 307 367 287 378 267 390 264 391 into these 4 columns:
1 1 1 1 1 1 1 1 1 1 406 318 379 346 379 304 352 363 351 351 330 371 329 359 309 379 307 367 291 391 287 378 271 402 267 390 268 403 264 391 that is, how reshape matrix size of nx2 size 10xm in matlab?
one solution using mat2cell, splitting every 10 rows. easier understand, because no 3d-matrices used:
cell2mat(mat2cell(x,repmat(10,size(x,1)/10,1),size(x,2))') second solution using reshape , permute, should faster did not try it.:
reshape(permute(reshape(x,10,[],size(x,2)),[1,3,2]),10,[])
Comments
Post a Comment