matlab single quote problem

how should I output this sentence in single quote instead of double quote? Because change the double quote to single quote directly is not work

 Respuesta aceptada

Brent Kostich
Brent Kostich el 28 de Mayo de 2020

0 votos

You need to use brackets when creating a multi-part sentence like that, which is equal to horzcat. Also, you need to use character segments, not strings.
pi = ['The approximation on ', num2str(n), ' terms is ', num2str(round(pi*4, 4))];

Más respuestas (0)

Categorías

Más información sobre Characters and Strings en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 28 de Mayo de 2020

Comentada:

el 28 de Mayo de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by