MATLAB: Remove a specific string from a cell matrix

cellcommandmatrixremovestring

Hello,
I have a question. I have a cell matrix 200×1 with the following format.
Temperature 10
Temperature 10
Temperature 25
Temperature 30
……………………
Temperature 150.
I would like to use a command which will "remove" the string "Temperature".
Does anybody knows which command should I use to make it?

Best Answer

Option 1: strrep() to replace 'Temperature ' with empty
C = {'Temperature 10';'Temperature 10';'Temperature 25';'Temperature 30'};
Ctrim = strrep(C,'Temperature ','') %cell array of chars containing only the numbers
Cnum = str2double(Ctrim); %vector of the numbers of class double.
Option 2: regexp() to extract the numeric characters
Ctrim = regexp(C,'\d+','match','once');
Cnum = ... %see above
Option 1 is faster.