フィルターのクリア

Turning a matrix into a vector issue where it truncates (easy question)

4 ビュー (過去 30 日間)
David Shulkin
David Shulkin 2019 年 12 月 18 日
編集済み: Ridwan Alam 2019 年 12 月 18 日
I have matrix that is 8 by 2 (messageSymbolDemod) that i want to become a single vector that would be 16 by 1(finalMessage)
finalMessage(:,1) = messageSymbolsDemod(:)
I am randomly generating bits to fill in the matrix and when the second column of the matrix are all 0 the finalMessage becomes a vector of 8 by 1 which gives me an error on later in the code.
How do I make it that even if the second column has all zeros that my finalMessage vector is still 16 by 1.
Thanks in advance!

採用された回答

Ridwan Alam
Ridwan Alam 2019 年 12 月 18 日
編集済み: Ridwan Alam 2019 年 12 月 18 日
finalMessage = reshape(messageSymbolsDemod,[],1); % from matrix to vector
finalMessage = padarray(finalMessage,16-length(finalMessage),'post'); % pad zero to ensure length = 16

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by