How to maintain NaN after calculations in tables?

8 views (last 30 days)
Sorry this is the first time I have posted a question.
I am trying to create a new column in my table using parameter like (rows = T.Age < 40). This creates a logical array of the same size as the original column, but when I create the new column and use T.new(:,:)=T.height(rows). It won't add the new column because the array is now smaller due to NaNs in my table.
How do i keep the NaN values and have it carry over and create a new column?

Accepted Answer

Walter Roberson
Walter Roberson on 17 Oct 2019
T.new(rows) = T.height(rows);
nanrows = isnan(T.Age);
T.new(nanrows) = nan;

More Answers (0)

Categories

Find more on Tables in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

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

Start Hunting!