MATLAB: How can replace randi instead randint

ofdm_basic

hi ;i have a question please help me , i want to replace randi instead randint in ofdm_basic code in r2017a , but i dont know how i must do it . please answer and help me . this is that line :
X=randint(1,Nused*Nframe,M); % bit: integer vector

Best Answer

Do you mean randint from the Communications Toolbox or is this from Octave code?
I assume, for both the answer is the same: It depends on what M is.
  • [0, range-1] if range is a positive integer
  • [range+1, 0] if range is a negative integer
  • Between min and max, inclusive, if range = [min,max] or [max,min]
% X = randint(1, Nused*Nframe, M)
if length(M) == 1
if M > 0
Range = [0, M-1];
else
Range = [M+1, 0];
end
else
Range = [min(M), max(M)];
end
X = randi(Range, 1, Nused*Nframe);
I do not have this toolbox, but I guess that you should find something like this, if you look into the randint function:
edit randint