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

1 view (last 30 days)
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 Comments
Image Analyst
Image Analyst on 8 Jan 2019
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.

Sign in to comment.

Answers (1)

Luna
Luna on 9 Jan 2019
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?

Categories

Find more on Resizing and Reshaping Matrices in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!