MATLAB: Is there a quick way to create a cell array of strings where strings represent workspace variables

cell arraysinverted quotationsstringvariablesworkspace

I want to create a cell array of strings, where the strings represent workspace variables. Suppose I have a,bb,ccc,dddd … z26, and so on as variables in the workspace. How can I create a cell array
vars = {… 'a' 'bb' 'ccc' . . . . 'z26' };
I have tried using who with asterix to list variables, or copying in excel and inserting columns of inverted quotations, etc. Any help greatly appreciated!

Best Answer

If you read the documentation for whos then you will find out that you can use wildcard matches like this:
whos('a*')
which matches all variables starting with the letter 'a'. To get a cell array of names without using a loop:
N = whos('a*');
N = {N.name};
Related Question