Double = in one line of code

1 次查看(过去 30 天)
Zeynab Mousavikhamene
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;

回答(2 个)

madhan ravi
madhan ravi 2019-8-13
doc deal

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 CenterFile Exchange 中查找有关 Logical 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by