Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

I need to create a 1x6 string combining strings?

1 visualización (últimos 30 días)
Jose Grimaldo
Jose Grimaldo el 4 de Feb. de 2020
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
Screenshot (204).png
Screenshot (203).png
I'm having trouble creating a 1x6 string setting X="I Love Pizza Not Vegatibles" using the variables L,I,J and also adding spaces. I'm assuming i have to combine strings to create a 1x6 string. There is also a space at the beginning .
  2 comentarios
Stephen23
Stephen23 el 4 de Feb. de 2020
What are "Vegatibles" ? Did your professor mean https://en.wikipedia.org/wiki/Vegetable ?
Jose Grimaldo
Jose Grimaldo el 4 de Feb. de 2020
I think is a typo, i think it was supposed to be "Vegetable"

Respuestas (2)

KSSV
KSSV el 4 de Feb. de 2020
Method 1:
% Add space with the strings itself
s1 = " I " ;
s2 = " LOVE " ;
s3 = " MATLAB " ;
iwant = [s1,s2,s3] ;
Method 2
% Add space at the time of joining
s1 = "I" ;
s2 = "LOVE" ;
s3 = "MATLAB" ;
iwant = [s1,' ',s2,' ',s3] ;

Bhaskar R
Bhaskar R el 4 de Feb. de 2020
Use + operator for string data type concatanation
X = space+ L+ space+ J+ space+ I+ space+ C; % this works for you

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by