Reduction in For Loop Execution Time

4 ビュー (過去 30 日間)
MrPuzzled Marc
MrPuzzled Marc 2011 年 4 月 24 日
Hi, I have a question. I developed a coding for send and receive binary bits. I need to arrange the bits into matrices before I could form back into its original format. For instance, I have 10101010101.... and i need to arrange in (1010;1010;0101...) or (3x1) matrices. Here is the code. for j=1:M b=16*(j); a=-15+b; Video_bin= [Video_bin;file(a:b)]; end will concatenate the bits into matrix form. however this gives a large execution time to my code. Any better function or solution for this?Thanks.

採用された回答

Oleg Komarov
Oleg Komarov 2011 年 4 月 24 日
Use reshape:
A = '101010101010';
B = reshape(A,4,[]).';

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by