5 views (last 30 days)
Johannes Deelstra on 5 Nov 2020
Answered: Priysha LNU on 11 Nov 2020
some cells in the excell file contain no data and instead have a decimal point,
how can I replace these cells with NaN
regards
Johannes
##### 2 CommentsShowHide 1 older comment
Johannes Deelstra on 5 Nov 2020
then the data are entered as
'01.05.1994' 0.450000000000000 '1.03' '0.04' '11' '0' '6.6' '1.6' '0.065' '18'
'02.05.1994' 0.360000000000000 '0.59' '0.028' '7' '0.1' '7.9' '0.9' '0.046' '12'
'03.05.1994' 0.310000000000000 '0.34' '0.022' '5' '0' '7.3' '0.5' '0.035' '9'
'04.05.1994' 0.300000000000000 '0.33' '0.021' '5' '0' '9.5' '0.5' '0.034' '9'
because tfhere is a series with no data indicated as
'11.01.1996' 0.110000000000000 '0.04' '0.002' '0' '2.998' '1.1' '0.1' '0.004' '1'
'12.01.1996' 0.160000000000000 '.' '.' '.' '1.996' '0.9' '.' '.' '.'
'13.01.1996' 0.130000000000000 '.' '.' '.' '6.3' '0.9' '.' '.' '.'
'14.01.1996' 0.710000000000000 '.' '.' '.' '3.7' '0.9' '.' '.' '.'
'15.01.1996' 0.590000000000000 '.' '.' '.' '0.1' '0.9' '.' '.' '.'
'16.01.1996' 0.400000000000000 '.' '.' '.' '0' '-0.8' '.' '.' '.'
regards
Johannes

Priysha LNU on 11 Nov 2020
Hi,
Try using the following code:
[m,n] = size(Data) %gives number of rows and columns in 'Data'
for i = 1:m
for j = 1:n
if strcmp(Data{i,j},'.') %check if cell content is "."
Data{i,j} = NaN %replace with NaN
end
end
end
DISCLAIMER: These are my own views and in no way depict those of MathWorks.

### Categories

Find more on Spreadsheets in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by