matlab single quote problem

2 Ansichten (letzte 30 Tage)
Maria
Maria am 28 Mai 2020
Kommentiert: Maria am 28 Mai 2020
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

Akzeptierte Antwort

Brent Kostich
Brent Kostich am 28 Mai 2020
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))];

Weitere Antworten (0)

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by