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

1 次查看(过去 30 天)
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.

请先登录,再进行评论。

回答(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 CenterFile Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by