MATLAB does not currently have the functionality to output multiple variables at once. The enhancement suggestion has been forwarded to the appropriate production team. It will be considered for inclusion in a future release of MATLAB. However, there are several options to work around this issue.
Use right-click -> Create Variable instead of going through the menu bar. Unfortunately this only saves a little time, as the user still has to create each variable individually.
Use a third party toolbox that can handle this.
However, MathWorks does not guarantee or warrant the use or content of these third-party submissions. Any questions, issues, or complaints should be directed to the contributing author.
Use the undocumented 'BrushData' property of a brush-able graphics object to see which data points are selected. Note that because it is undocumented, it may be removed in a future release of MATLAB. The 'BrushData' property is a "uint8" array of 0s and 1s, with 1s indicating data points that are selected. This must be transformed into logical array before it can be used to index into the data arrays.
See the attached "saveBrushDataScript.m" file for an example of the use of this property.
Unfortunately, this requires more interaction from the user, and probably means going back and forth from the figure and the command window to specify when the current selection is done. Variables will also have to be named programmatically, or through interaction in the the command window.
Similar to Option 3, use the 'BrushData' property in conjunction with the Data Brush tool's 'ActionPostCallback'. This will allow an action to be taken every time the Data Brush finishes a selection action (on the release of the mouse button). The callback can extract the 'BrushData' property from each line, and get the selected data by indexing into the 'XData' and 'YData' properties. The output happens in the background with no interaction from the user.
Unfortunately, this action will occur every time a selection is complete. The user may still be selecting more data points or removing them (using the Ctrl and Shift keys). The variables will also need to be named programmatically, and there may be issues with them overwriting variables that had already been saved.
See the attached "saveBrushDataCallback.m" file for an example of the use of this callback.
Some of the issues could be mitigated by using a dialog box, allowing the user to choose whether or not to save the selection, and also enter variable name(s) there.