How to handle long code?

I am creating a matrix and the code is very long as I am using diag to create diags of ones at different places in the matrix. Is there some way to keep the string complete even when going to a new line? The sting of code is stretching well out of bounds
Thanks

답변 (1개)

Walter Roberson
Walter Roberson 2012년 2월 8일

0 개 추천

You can continue code by typing 3 dots at the end of a line and then moving on to the next line
fidnerts = this + ...
that .* the ...
./ other;
Note: you cannot break up a literal string this way.
nirfinw = 'this is ...
not legal!';

카테고리

도움말 센터File Exchange에서 Numeric Types에 대해 자세히 알아보기

태그

질문:

2012년 2월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by