# Set of sequnce number

1 view (last 30 days)
Dhafar hamed on 17 Sep 2020
Commented: Dhafar hamed on 18 Sep 2020
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.

Fangjun Jiang on 17 Sep 2020
%%
A=1:8;
N=numel(A);
Multiply=10.^(N-1:-1:0)';
B=A*Multiply
C=dec2hex(B)

#### 1 Comment

Dhafar hamed on 18 Sep 2020
Thank u very much

Ameer Hamza on 17 Sep 2020
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);

Show 1 older comment
Dhafar hamed on 18 Sep 2020
It is work but if I have 50 number then hex DOS not work
Ameer Hamza on 18 Sep 2020
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 =
Dhafar hamed on 18 Sep 2020
Thank you very much I don't know why its DOS not work with me

Bruno Luong on 18 Sep 2020
>> A = [1,2,3,4,5,6,7,8]
A =
1 2 3 4 5 6 7 8
>> polyval(A,10)
ans =
12345678

#### 1 Comment

Dhafar hamed on 18 Sep 2020
It is give only one number