Can I comment only a section or part of a line?

49 ビュー (過去 30 日間)
Guilherme Caseiro
Guilherme Caseiro 2022 年 4 月 2 日
コメント済み: Guilherme Caseiro 2022 年 4 月 2 日
Example of what I wish to do:
plot(x1,y1,{comment only inside brackets},x2,y2);
Is there any way to comment only specific parts of a line of code/text while the rest stays uncommented?
Also /* */ only seems to work on c code not on all text, and I wish to do this as I showed above on a plot.
  1 件のコメント
Guilherme Caseiro
Guilherme Caseiro 2022 年 4 月 2 日
Thanks all of you for answering so quickly. Sadly I really wanted all in one line, but the option you guys gave me serves perfectly fine.

サインインしてコメントする。

採用された回答

Jan
Jan 2022 年 4 月 2 日
編集済み: Jan 2022 年 4 月 2 日
No, this is not possible in Matlab.
It would be dangerous also, because it could move some code on the right side of the line out of the editor window.
The correct way in your case:
plot(x1,y1, ... % comment here
x2,y2);
  1 件のコメント
Guilherme Caseiro
Guilherme Caseiro 2022 年 4 月 2 日
Thanks for the quick answer.

サインインしてコメントする。

その他の回答 (2 件)

Voss
Voss 2022 年 4 月 2 日
I think the best you can do is this:
plot(x1,y1, ...{comment only inside brackets},
x2,y2);

Alan Stevens
Alan Stevens 2022 年 4 月 2 日
Like this:
x = linspace(0,2*pi,100);
y1 = sin(x);
y2 = cos(x);
plot(x,y1,... % comment
x,y2)

カテゴリ

Help Center および File ExchangeGraphics Performance についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by