[問題] 請問一下如何使用bin2dec已回收

看板MATLAB作者 (曹操)時間15年前 (2010/07/07 14:29), 編輯推噓2(203)
留言5則, 3人參與, 最新討論串1/1
A=randint(2,2040) 可以產生2x2040的二進制值 請問一下如何產生2x255的10進制(每8bits變成一個10進制值) 我使用 Y= bin2dec(num2str(A,'%d')) 會產生 Binary string must be 52 bits or less. 請問一下如何解決 非常感謝 -- brother by chance friend by choice -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.118.102.208

07/07 15:34, , 1F
應該試一下 dec2bin 就知道怎麼用bin2dec
07/07 15:34, 1F

07/07 15:41, , 2F
我有使用過 想請問是說用bin2dec如何解決52bits的問題
07/07 15:41, 2F

07/08 00:04, , 3F
blkproc(A,[1,8],'sum(x.*2.^(7:-1:0))')
07/08 00:04, 3F

07/08 00:07, , 4F
為什麼不從randint直接生成2*255 0~255的亂數就好呢?
07/08 00:07, 4F

07/12 15:26, , 5F
感謝b大 因為我的資料是像A一樣 所以才用randint當例子
07/12 15:26, 5F
文章代碼(AID): #1CD1xKl5 (MATLAB)