Why last line of the code says "Error using reshape Size arguments must be real integers."
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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');
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/833040/image.jpeg)
1 Kommentar
Stephen23
am 13 Dez. 2021
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 ?
Antworten (1)
Ashutosh Singh Baghel
am 20 Dez. 2021
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)
size(B)
1 Kommentar
Walter Roberson
am 20 Dez. 2021
k = 8;
B = reshape(A, k, []);
would also work.
Siehe auch
Kategorien
Mehr zu Test and Measurement finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!