Concatinate number and character

I have numerical data in cell and i want to add character before that numerical data how can i do it ?
Suppose i have numerical value 50 in particular position in cell i want to make it A50.
Thanks in advance.

 Réponse acceptée

David Sanchez
David Sanchez le 25 Juil 2013

0 votes

my_char = 'A';
my_number = 50;
my_string = strcat(my_char,num2str(my_number));

4 commentaires

siddhesh rane
siddhesh rane le 25 Juil 2013
thaks a lot !!
siddhesh rane
siddhesh rane le 25 Juil 2013
Is it possible to store it without apostrophe..like A50 instead of 'A50'.
% char(39) is apostrophe according to ASCII table, then:
str_with_apost = strcat(char(39), 'A50',char(39))
siddhesh rane
siddhesh rane le 25 Juil 2013
its not working..what if i changed it from string to double?

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Characters and Strings dans Centre d'aide et File Exchange

Produits

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by