这是我正在寻找的一个例子:
>> foo = [88, 12];
>> [x, y] = foo;
Run Code Online (Sandbox Code Playgroud)
之后我会期待这样的事情:
>> x
x =
88
>> y
y =
12
Run Code Online (Sandbox Code Playgroud)
但相反,我得到的错误如下:
??? Too many output arguments.
Run Code Online (Sandbox Code Playgroud)
我想deal()可能会这样做,但它似乎只适用于细胞.
>> [x, y] = deal(foo{:});
??? Cell contents reference from a non-cell array object.
Run Code Online (Sandbox Code Playgroud)
我该如何解决我的问题?如果我想单独处理它们,我必须经常索引1和2吗?