MATLAB: Find within string, location where space doesn’t occur before upper (capital) letter

MATLABstring upper space

I have multiple strings from excel file and would like to do the following.
string='GeneralCase and UpperManagement'
So I would like to extract first
'General'
then
'Case and Upper'
then
'Management'
Is this possible using regexp?
Thanks in advance for your help

Best Answer

To get the indices
ind = regexp(string, '(^|[^ ])[A-Z]');
To extract the strings from the indices
L{1} = string(1:ind(2));
for i=2:numel(ind)-1
L{end+1} = string(ind(i)+1:ind(i+1));
end
if numel(ind) > 1
L{end+1} = string(ind(end)+1:end);
end