could anyone help me to overcome the error stating RESHAPE the number of elements must not change.

1 回表示 (過去 30 日間)
jaah navi
jaah navi 2019 年 1 月 8 日
編集済み: Luna 2019 年 1 月 9 日
function [ rx_data ] = ofdm_rx( sym_seq, mod_ofdm )
N_data = mod_ofdm.FFTLength - sum(mod_ofdm.NumGuardBandCarriers) - 1 - length(mod_ofdm.PilotCarrierIndices);
N_P = length(mod_ofdm.PilotCarrierIndices);
num_ofdmsym = mod_ofdm.NumSymbols;
pilot_seq_complex = rand (N_P, num_ofdmsym), rand (N_P, num_ofdmsym);
sym_mat = reshape(sym_seq, N_data, num_ofdmsym);
rx_data = step(mod_ofdm,sym_mat,pilot_seq_complex);
end
When i run the code containinf function i am getting error stating
Error using reshape
To RESHAPE the number of elements must not change.
Error in line 10 sym_mat = reshape(sym_seq, N_data, num_ofdmsym);
  4 件のコメント
Image Analyst
Image Analyst 2019 年 1 月 8 日
Luna, please put answers down BELOW in the official Answers section, so you can get credit for it. Your first comment looks pretty much like an answer to me.
Luna
Luna 2019 年 1 月 9 日
編集済み: Luna 2019 年 1 月 9 日
Thanks, I moved the comment down as an answer :)

サインインしてコメントする。

回答 (1 件)

Luna
Luna 2019 年 1 月 9 日
Actually the error gives you the hint. The number of elements inside the array should be equal to multiplication of dimensions.
For example:
A is MxN matrix, and you want to reshape it into PxR matrix. Then M*N should be equal to P*R. So that reshape function can work as follows:
newA = reshape(A,P,R);
What is sym_seq, mod_ofdm ? And what do you want as desired output?

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by