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

1 visualización (últimos 30 días)
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 comentarios
Image Analyst
Image Analyst el 8 de En. de 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.
Luna
Luna el 9 de En. de 2019
Editada: Luna el 9 de En. de 2019
Thanks, I moved the comment down as an answer :)

Iniciar sesión para comentar.

Respuestas (1)

Luna
Luna el 9 de En. de 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?

Categorías

Más información sobre Resizing and Reshaping Matrices en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by