Hello i'm getting this error...can any one help me out?

1 view (last 30 days)
Error using reshape; Size arguments must be real integers.
Error in Channel_behaviour (line 7); xsym = bin2dec(reshape(x,k,length(x)/k).','left-msb');% Convert the bits in x into k-bit symbols.
This is my code:

Accepted Answer

Star Strider
Star Strider on 23 Nov 2014
There is actually nothing to reshape anyway. Two of the reshape arguments are scalars (specifically ‘n’=256 and ‘k’=4, and since length(x)=1, the last size argument is going to be length(x)/k=1/4 which is not an acceptable size for a matrix or array.
I’m not really certain what you’re doing, but you might want to revise the documentation on randi. I believe you were expecting ‘x’ to be a vector.
  2 Comments
Prudhvi Muppalla
Prudhvi Muppalla on 24 Nov 2014
Edited: Prudhvi Muppalla on 24 Nov 2014
Thank you for your answer star strider.can u please tell me which function can i use instead of randi to make it working.It will be a great help for me.I'm trying to get the OFDM channel estimation. Please see the attached file for the code.
Star Strider
Star Strider on 24 Nov 2014
The randi function will work, and do exactly what you want it to do. You just have to tell it. If you want a vector of 20 digits from 0-9, ‘x’ becomes:
x = randi([0 9],1,20);
See the documentation on randi for details.

Sign in to comment.

More Answers (0)

Categories

Find more on Data Distribution Plots 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!