How to convert cell array with Nan to a double array with Nan=0?

19 views (last 30 days)
I have imported data with NaN and other values all in one column. I need to convert this into a double array where all of NaNs are set to zero. Please help! Thanks!

Answers (1)

Cedric Wannaz
Cedric Wannaz on 26 Sep 2017
Edited: Cedric Wannaz on 26 Sep 2017
x = cell2mat(C) ;
x(isnan(x)) = 0 ;
  2 Comments
Cedric Wannaz
Cedric Wannaz on 26 Sep 2017
Then it's not all in one column I guess, but you have a cell array of vectors or a cell array of cell arrays. Can you copy/past part of the content?

Sign in to comment.

Categories

Find more on Cell Arrays 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!