Im trying to combine two string together

4 visualizaciones (últimos 30 días)
Jesse Abruzzo
Jesse Abruzzo el 19 de Oct. de 2016
Comentada: Walter Roberson el 21 de Oct. de 2016
get(handles.OptionsText, 'String')
String = sprintf('\n\n2: ')
set(handles.OptionsText, 'String', sprintf( (get(handles.OptionsText, 'String')), String));
get(handles.OptionsText, 'String') is below:Also the dimensions are 2 14.
1: Rectangular
1.2:
and i have this string: Dimsensions 1 7.
space
space
2:
Whenever i try to combine them it just kinda mashes them. The result is this:
1 : R e c t1a.n2g:u l a r
I would like to have a result of this:
1: Rectangular
1.2:
2:

Respuestas (1)

Walter Roberson
Walter Roberson el 19 de Oct. de 2016
Skip most of what you have.
String = sprintf('\n\n2: '); %needed to transform the \n into real characters
oldstring = get(handles.OptionsText, 'String');
newstring = [oldstring, String];
set(handles.OptionsText, 'String', newstring );
  4 comentarios
Jesse Abruzzo
Jesse Abruzzo el 21 de Oct. de 2016
I didnt try this code. But i ended up changing my program a bit and dont need this anymore. Thank you for your response! I do have another question about a swuare eave im trying to make if you wanna answer that. Thanks again
Walter Roberson
Walter Roberson el 21 de Oct. de 2016
You should create a new Question for that.

Iniciar sesión para comentar.

Categorías

Más información sobre Characters and Strings en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by