MATLAB: How to convert a cell array with values {‘S101’ ‘S102’},to a double array

cell to double

events = {'S100';'S102';'S103';'S101'}

Best Answer

Making some assumptions:
>> events = {'S100';'S102';'S103';'S101'};
>> str2double(strrep(events,'S','')) % easy
ans =
100
102
103
101
>> sscanf(sprintf('%s\v',events{:}),'S%d\v') % probably more efficient
ans =
100
102
103
101