How do I do multiple assignment in MATLAB
Share this page | Read it later using CloudBreak Wallabag
From my question on StackOverflow (CC BY-SA 3.0):
Here’s an example of what I’m looking for:
>> foo = [88, 12]; >> [x, y] = foo;I’d expect something like this afterwards:
>> x x = 88 >> y y = 12But instead I get errors like:
??? Too many output arguments.I thought
deal()might do it, but it seems to only work on cells.>> [x, y] = deal(foo{:}); ??? Cell contents reference from a non-cell array object.How do I solve my problem? Must I constantly index by 1 and 2 if I want to deal with them separately?