… tells MATLAB to ignore the rest of the line, and continue the execution of the current statement to the next line. This operator is often referred as “the ellipsis”, and MATLAB interprets it as a space character.
Use the ellipsis to create multiline statements, and to comment out parts of multiline statements.
% Sum numbers in multiple lines y = 1 + ... 2 + ... 3;
y = 6
% Create a matrix using one line per row matrix = [... 1, 2, 3; ... 4, 5, 6; ... 7, 8, 9 ... ];
matrix = 1 2 3 4 5 6 7 8 9
% Build a long string str = ['Visit the ImageProcessingLog.Com website and find calls for papers', ... ', news, jobs, tutorials, opinion articles, and exams about', ... ' digital image processing and related fields.'];
str = Visit the ImageProcessingLog.Com website and find calls for papers, news, jobs, tutorials, opinion articles, and exams about digital image processing and related fields.
% Comment out parts of a multiline statement newMatrix = [... 1, 2, 3; ... ... 4, 5, 6; ... 7, 8, 9 ... ];
newMatrix = 1 2 3 7 8 9
I recommend the following book to learn more on how the line continuation operator works in MATLAB:
This book was the winner of a 2017 Textbook Excellence Award. The first chapter explains the line continuation operator, among other introductory topics like random numbers generation, trigonometry, and how to get help in MATLAB.
I also recommend the other tutorials in this series.
I hope you have learned how to use the line continuation operator in MATLAB. The source code developed in this tutorial is available at this page.