Double = in one line of code

1 回表示 (過去 30 日間)
Zeynab Mousavikhamene
Zeynab Mousavikhamene 2019 年 8 月 13 日
コメント済み: James Tursa 2019 年 8 月 13 日
Can I define a=b=c in one line of code in matlab? if yes what is the syntax?
I do not want to define in double section like a=b; c=b;
  1 件のコメント
James Tursa
James Tursa 2019 年 8 月 13 日
What do you have against a=b; c=b; ?

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

回答 (2 件)

madhan ravi
madhan ravi 2019 年 8 月 13 日

Andrei Bobrov
Andrei Bobrov 2019 年 8 月 13 日
b = 1000;
zz = {b};
[a,c] = zz{[1,1]};
  1 件のコメント
Rik
Rik 2019 年 8 月 13 日
Nice hack, although I think deal is more clear when reading the code. I didn't know this syntax also generated a comma-separated list like {:} does.

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

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by