필터 지우기
필터 지우기

what is the meaning of these random numbers

조회 수: 2 (최근 30일)
Ayesha Punjabi
Ayesha Punjabi 2019년 3월 11일
답변: Walter Roberson 2021년 8월 15일
  • does anyone know the meaning of this ?
  • >> r = (randi(0:1, 5, 16)+'0')
  • tag_arr =
  • 49 48 48 49 48 48 49 48 48 49 49 48 48 49 49 49
  • 49 49 49 48 49 48 48 49 48 49 49 48 48 49 49 49
  • 48 49 49 48 49 49 48 48 49 48 49 48 49 48 48 48
  • 49 48 49 49 49 48 48 48 48 49 48 48 48 48 49 48
  • 48 49 49 48 48 49 48 49 49 48 49 48 49 48 49 49
  • I am trying to understant why is it giving me only 48 and 49 values?? what is the meaning of this output.?

답변 (2개)

Star Strider
Star Strider 2019년 3월 11일
it is giving you a (5 x 16) matrix of ASCII values for '0' and '1'.

Walter Roberson
Walter Roberson 2021년 8월 15일
The character code for the character '0' is 48. You are generating random numbers that are either 0 or 1, and you are adding 48, so you are getting 48 or 49. You could have done,
targ_arr = char(randi(0:1, 5, 16)+'0')
targ_arr = 5×16 char array
'0111111100101111' '1001111011011101' '1111010110111000' '0100010110011011' '0000010011001101'
to see the character equivalents.
https://en.wikipedia.org/wiki/Basic_Latin_(Unicode_block) U+0030 is '0' . U+ numbers are in hex, so
hex2dec('0030')
ans = 48

카테고리

Help CenterFile Exchange에서 Waveform Generation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by