Remove NaN and create one column

1 view (last 30 days)
Damith
Damith on 3 Jul 2014
Commented: Damith on 4 Jul 2014
Hi,
I have a matrix A (31 x 12) which has NaN values and need to remove all NaN values and make it a one column (:). How can I do it MATLAB?
  1 Comment
per isakson
per isakson on 4 Jul 2014
Edited: per isakson on 4 Jul 2014
Delete one of your two nearly identical questions!

Sign in to comment.

Accepted Answer

per isakson
per isakson on 4 Jul 2014
"I have this matrix A and has NaN values. I need
  1. to remove NaN values from all the columns and
  2. write the values into one column (:)."
Step one is not possible because it would result in columns with different length.
Switching the order of the steps will return a result
A = A(:);
A( isnan( A ) ) = [];
  1 Comment
Damith
Damith on 4 Jul 2014
Thanks a lot. It worked. This is the result I wanted.

Sign in to comment.

More Answers (0)

Categories

Find more on Creating and Concatenating Matrices 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!