Using a base bigger than 36

조회 수: 11 (최근 30일)
Raldi
Raldi 2014년 4월 14일
편집: Niklas Nylén 2014년 4월 14일
Hi everyone,
Do you know how can I possibly transform a vector that could be base2 , base7 , but also bigger like base128 or base150 into a decimal. Because base2dec seems to only go as high as base36

채택된 답변

Niklas Nylén
Niklas Nylén 2014년 4월 14일
You can see the code of base2dec by writing
edit base2dec
The reason it is limited to base 36 seems to be that you run out of letters in the english alphabet. You should be able to copy base2dec and add more symbols for a higher base.
  댓글 수: 2
Raldi
Raldi 2014년 4월 14일
That still is not exactly what i want because, lets say i have a big vector
[ 0 0 0 3 0 0 0 2 0 56]
that is in base100 , what i want is to convert this into a decimal number.
Niklas Nylén
Niklas Nylén 2014년 4월 14일
편집: Niklas Nylén 2014년 4월 14일
That requires some other, still small, adaptations of base2dec. More specifically you need to remove the value conversion lines near the end and use your vector as input.
Or you could write your own conversion code, which is not that difficult.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by