How to do Batch Assignment

16 次查看(过去 30 天)
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