MATLAB: Problem with TreatasEmpty using textscan command

textscan

I am having issues reading a data file. The particular line of code that I am having problems with involves treatasempty and textscan.
Below is the data line that I am having issues with:
STM SPEED (KT) 10 12 12 12 12 12 N/A N/A N/A N/A N/A N/A N/A
Right now, I navigate to grab the necessary information from this line with the command
stormspeed = textscan(fid, '%s' , 12. 'HeaderLines',13, 'treatAsEmpty',{'N/A'});
The problem is stormspeed does not correspond to what I want. For example, stormspeed{1}=
'STM'
'SPEED'
'(KT)'
'10'
'12'
'12'
'12'
'12'
'12'
'N/A'
'N/A'
'N/A'
But I want the N/A to be replaced with NaN. Is this possible?
thanks, Kieran

Best Answer

strrep(stormspeed{1},'N/A','NaN')