reshape, remove 16 elements, keep 1000*8, remove ..

Can I solve this without a loop?/What is the fastest way? I have a long vector consisting of [16Elements 1000*8Elements 16Elements 1000*8Elements ...] With a total of N repetitions. The 16 Elements I want to remove. The remainder I would like to reshape into a matrix of size 1000xNx8 Thanks!

回答 (1 件)

Guillaume
Guillaume 2017 年 4 月 25 日

0 投票

reshape into 16+1000*8 x N matrix, get rid of the first 16 rows, then reshape again. Finally a permute if you want N to be the second dimension.
tocrop = reshape(yourvector, 16+1000*8, []);
out = permute(reshape(tocrop(17:end, :), 1000, 8, []), [1 3 2])

カテゴリ

ヘルプ センター および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

質問済み:

T
T
2017 年 4 月 25 日

回答済み:

2017 年 4 月 25 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by