Can we add a statement in between the codes?

Is it possible to add statements in between the codes. For example: If I have a code like this,
r(:,1) = a(:,1) - a(:,2);
Then can I write it as,
r(:,1) = a(:,1)("this is a constant") - a(:,2)("this is a variable");

 채택된 답변

dpb
dpb 2015년 6월 15일

1 개 추천

Nyet, no such syntax exists.
About the closest you can get is something like
r = a - ... % this is a constant
b; % this is a variable
BTW: in Matlab the single quote is used for character constants, not the apostrophe.
See the Getting Started section in the doc on the basic syntax
doc punct % will get you to the special punctuation including %
>>

댓글 수: 1

nashyshan
nashyshan 2015년 6월 15일
Well I just used that as an example.
Anyway thanks for your help.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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

태그

아직 태그를 입력하지 않았습니다.

질문:

2015년 6월 15일

댓글:

2015년 6월 15일

Community Treasure Hunt

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

Start Hunting!

Translated by