Why last line of the code says "Error using reshape Size arguments must be real integers."

조회 수: 1 (최근 30일)
n = 256; % Number of bits to process
x = randint(n,1); % Random binary data stream
M = 16; % Size of signal constellation
k = log2(M); % Number of bits per symbol
xsym = bi2de(reshape(x,k,length(x)/k).','left-msb');
  댓글 수: 1
Stephen23
Stephen23 2021년 12월 13일
According to the Communications Toolbox Release Notes the randint function was removed in release R2016b.
How are you managing to use randint with release R2019b ?

댓글을 달려면 로그인하십시오.

답변 (1개)

Ashutosh Singh Baghel
Ashutosh Singh Baghel 2021년 12월 20일
Hi nur,
I understand you want to generate a random stream of 1's and 0's. According to the R2016b release notes, it clearly states - '"Replace all instances of randint with randi."
'randint(1,1,[1,n])' would now be written as 'randi([1,n],1,1)'.
Please see the following example -
n = 256; % Number of bits to process
A = randi([0 1],n,1); % Random binary data stream
Also, using reshape function , the syntax is as -
k = 8;
B = reshape(A,[k,n/k]);
size(A)
ans = 1×2
256 1
size(B)
ans = 1×2
8 32
Please follow the MATLAB Documnetation link for 'reshape','randi' and 'R2016b release notes.'

카테고리

Help CenterFile Exchange에서 Test and Measurement에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by