Can we add a statement in between the codes?

1 Ansicht (letzte 30 Tage)
nashyshan
nashyshan am 15 Jun. 2015
Kommentiert: nashyshan am 15 Jun. 2015
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");

Akzeptierte Antwort

dpb
dpb am 15 Jun. 2015
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 Kommentar
nashyshan
nashyshan am 15 Jun. 2015
Well I just used that as an example.
Anyway thanks for your help.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange

Tags

Noch keine Tags eingegeben.

Community Treasure Hunt

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

Start Hunting!

Translated by