Assign Multiple Variables
1,401 views (last 30 days)
I have a array for example [1,2,3,4]. I want to assign a variable to each number in the array such that a=1, b=2, c=3, and d=4. I know I can do each one separately but I want to know if it is possible to this in one line.
More Answers (3)
Raziman Thottungal Valapu on 1 Oct 2020
It is now possible to do this in one line cleanly
[a,b,c] = deal(1, "test", [1:5])
1 2 3 4 5