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!

Skip to content# MATLAB: How to do Batch Assignment

###### Related Question

MATLABvariable

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!

## Best Answer