>>>
>>> hi,
>>>
>>> look this:
>>>
>>> i've array cell
>>>
>>> [84,1] = 01-Apr-2018
>>> [85,1] =Nan
>>> [86,1] =Nan
>>> [87,1] =Nan
>>> [88,1] = 01-Ago-2018
>>> [89,1] =Nan
>>> [90,1] =Nan
>>>
>>> i try to convert it in serial day number array
>>>
>>> datenum (string_dat_rp)
>>>
>>> but i receive this error:
>>>
>>> error: datevec: none of the standard formats match the DATE string
>>>
>> Il Mercoledì 18 Luglio 2018 13:08, Kai Torben Ohlhus <
address@hidden> ha scritto:
>>
>> The problem is clear:
>>
>> >> datenum ("Nan")
>> error: datevec: none of the standard formats match the DATE string
>>
>> What do you expect the output to be in this case?
>>
>> Kai
>>
> On Wed, Jul 18, 2018 at 1:25 PM luca salardi <
address@hidden> wrote:
> hi, kai
>
> i expect this:
>
> [84,1] = 77778987
> [85,1] =Nan
> [86,1] =Nan
> [87,1] =Nan
> [88,1] = 77778983
> [89,1] =Nan
> [90,1] =Nan
>
Please make sure, to keep the mailing list in the CC, that others may benefit from this question and we use bottom posting [1] for the emails, even many clients do not support this by default.
Okay, then you have to make sure, that datenum does not have to process the invalid string "Nan"
string_dat_rp = {"01-Apr-2018", "Nan", "Nan", "Nan", "01-Aug-2018", "Nan", "Nan"};
my_nans = cellfun (@(x) isequal (x, "Nan"), string_dat_rp);
string_dat_rp(my_nans) = nan;
string_dat_rp(~my_nans) = num2cell (cellfun (@datenum, (string_dat_rp(~my_nans))));
disp (string_dat_rp)
{
[1,1] = 737151
[1,2] = NaN
[1,3] = NaN
[1,4] = NaN
[1,5] = 737273
[1,6] = NaN
[1,7] = NaN
}
My values are a bit different (used "Aug" instead of Italian "Ago") but I think the point is clear.
HTH,
Kai