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
  1 件のコメント
Yize Wang
Yize Wang 2019 年 5 月 31 日
Thanks!

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

その他の回答 (0 件)

カテゴリ

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