How to replace a word with an integer?

I have a large matrix file [1600*2000], generated from a code that gives the data at successive time intervals.I am getting the unwanted characters 'NoValue' ,I need to filter out that for post-processing by making it zero. It looks like this:
116.001 180.025E-06 4.51829E-06 8.02768E-06 601.401E-09 -985.998E-09 16.2926E-06 17.9909E-06 5.24019E-06 23.7763E-06 276.245E-06
116.001 NoValue NoValue NoValue NoValue NoValue NoValue NoValue NoValue NoValue 39.7286E-06
116.501 102.501E-06 -3.25017E-06 14.5043E-06 -9.05592E-06 2.47237E-06 18.8237E-06 13.5677E-06 1.5428E-06 21.5208E-06 381.746E-06
116.501 NoValue NoValue NoValue NoValue NoValue NoValue NoValue NoValue NoValue 59.1919E-06
117.001 -3.02866E-06 -2.72697E-06 18.2928E-06 -28.2147E-06 -14.9093E-06 1.01413E-06 10.9297E-06 12.9458E-06 9.54334E-06 22.8565E-06
117.001 NoValue NoValue NoValue
Any kind of help is welcome.

回答(1 个)

A(cellfun(@(x) ~isempty(strfind(x,'NoValue')),A))={0} % A is your cell array
%or
A(strcmp(a,'NoValue'))={0}

类别

在 帮助中心 和 File Exchange 中查找有关 Physics 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by