Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Set of sequnce number

조회 수: 1 (최근 30일)
Dhafar hamed
Dhafar hamed 2020년 9월 17일
마감: MATLAB Answer Bot 2021년 8월 20일
If I have this list of number A = [1,2,3,4,5,6,7,8] I want these number become as 12345678 and covert to hex number.

답변 (3개)

Fangjun Jiang
Fangjun Jiang 2020년 9월 17일
%%
A=1:8;
N=numel(A);
Multiply=10.^(N-1:-1:0)';
B=A*Multiply
C=dec2hex(B)
  댓글 수: 1
Dhafar hamed
Dhafar hamed 2020년 9월 18일
Thank u very much

Ameer Hamza
Ameer Hamza 2020년 9월 17일
If the number is not very large, then use
A = [1,2,3,4,5,6,7,8];
n = numel(A);
num = 10.^(n-1:-1:0)*A.';
hex = dec2hex(num);
However, if the number is large then you will need symbolic toolbox
A = sym([1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9]);
n = numel(A);
num = 10.^(n-1:-1:0)*A.';
hex = dec2hex(num);
  댓글 수: 4
Ameer Hamza
Ameer Hamza 2020년 9월 18일
It is working on my system
A = sym([1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9]);
n = numel(A);
num = 10.^(n-1:-1:0)*A.';
hex = dec2hex(num);
Result
>> num
num =
123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789
>> hex
hex =
'D750EB5568D054990864A04EEEFA6323673AEBD63A4AD487F13BFE74B7FC29A13A5F57B73C72870B684045F15'
Dhafar hamed
Dhafar hamed 2020년 9월 18일
Thank you very much I don't know why its DOS not work with me

Bruno Luong
Bruno Luong 2020년 9월 18일
>> A = [1,2,3,4,5,6,7,8]
A =
1 2 3 4 5 6 7 8
>> polyval(A,10)
ans =
12345678
  댓글 수: 1
Dhafar hamed
Dhafar hamed 2020년 9월 18일
It is give only one number

Community Treasure Hunt

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

Start Hunting!

Translated by