How to do Batch Assignment

조회 수: 17 (최근 30일)
Yize Wang
Yize Wang 2019년 5월 29일
댓글: Yize Wang 2019년 5월 31일
Hello,
I am wondering whether there is a way in MATLAB to assign multiple variables with in a single line of code. What I am looking for is as something as follows,
[x,y,z]=[1,2,3]
instead of,
x = 1;
y = 2;
z = 3;
Thanks in advance!

채택된 답변

KALYAN ACHARJYA
KALYAN ACHARJYA 2019년 5월 29일
편집: KALYAN ACHARJYA 2019년 5월 29일
>> [x,y,z]=matsplit([1,2,3]);
Result
x =
1
y =
2
z =
3
Use matsplit custom function here

추가 답변 (0개)

카테고리

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