Quantcast
Channel: MATLAB Central Newsreader Recent Posts
Viewing all articles
Browse latest Browse all 19628

Re: Skipping unexpected format in textscan

$
0
0
Thanks, Gadi. That's a better solution.

Gadi Reinhorn <greinhorn@mathworks.com> wrote in message <51894600.5050903@mathworks.com>...
> Nathan,
>
> Perhaps the TreatAsEmpty option to textscan can help you:
>
> TreatAsEmpty String(s) in the data file to None
> treat as an empty value. Can be a
> single string or cell array of
> strings. Only applies to numeric
> fields.
>
> Here is an example:
>
> >> a=textscan(sprintf('1,2,3\n4,#Ref,6\n7,8,9'),...
> '%f','Delimiter',',','TreatAsEmpty','#Ref');a{:}
>
> ans =
>
> 1
> 2
> 3
> 4
> NaN
> 6
> 7
> 8
> 9
>
> >>
>
>
> Hope that helps,
> Gadi

Viewing all articles
Browse latest Browse all 19628

Trending Articles