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일
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