MATLAB: Assign Multiple Variables

arrays matrix variables

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.

Best Answer

It is not possible in one statement. It is possible in two statements, which you could combine on one line.
t = num2cell([1,2,3,4]);
[a,b,c,d] = deal(t{:});