join numbers in vector
Afficher commentaires plus anciens
I have a row vector with 7 numbers, e.g. 13 30 44 12 44 23 12. I want to join all these numbers into a single number, or 13304412442312. I have not been able to find a method to do this. Can anyone please suggest a method to do this without using a for loop.
Réponse acceptée
Plus de réponses (2)
Azzi Abdelmalek
le 23 Juil 2013
Modifié(e) : Azzi Abdelmalek
le 23 Juil 2013
a=[13 30 44 12 44 23 12]
b=strrep(num2str(a),' ','')
% This is a string, if you to get a number
b=str2num(strrep(num2str(a),' ',''))
dpb
le 23 Juil 2013
>> sscanf(sprintf('%d',v),'%lu')
ans =
13304412442312
>> whos ans
Name Size Bytes Class Attributes
ans 1x1 8 uint64
>> sscanf(sprintf('%d',v),'%li')
ans =
13304412442312
>> whos ans
Name Size Bytes Class Attributes
ans 1x1 8 int64
>>
Catégories
En savoir plus sur Logical dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!