Reputation: 1
I have a matrix of 3 digit numbers, for example
102 106 100 100 100 100 100
106 102 100 100 100 100 100
106 101 120 106 109 119 108
104 115 107 106 109 119 108
I would like to combine each row into a single number, like so
102106100100100100100
106102100100100100100
106101120106109
...etc. I would really appreciate any feedback. Thank you :)
Upvotes: 0
Views: 507
Reputation: 112689
I assume the input is a numeric 2D array.
If you want the result in string form (2D char array where each row represents a number):
result = num2str(A, '%i'); %// or change format specifier if the numers are not naturals
If you want the result in numeric form (column vector of numbers):
result = str2num(num2str(A, '%i'));
Upvotes: 2