MATLAB Answers

0

Removing NaN values in Structure

Asked by Diego Fonseca on 11 Jun 2019
Latest activity Commented on by Diego Fonseca on 11 Jun 2019
Hello!
I have a struct called "modelo" that contains (among other variables) a numeric variable called "Val", which is 41714x81X29. There are random NaN's scattered throughout the data in this struct and I would like to remove them, creating a new variable without any NaN. I have tried writng:
modelo2 = modelo(~isnan([modelo.Val(:,:,:]));
but it says "Index exceeds matrix dimensions".
Does anyone could helpe me, please?

  0 Comments

Sign in to comment.

Tags

Products


Release

R2016a

1 Answer

Answer by madhan ravi
on 11 Jun 2019
 Accepted Answer

modelo2 = modelo.Val(~isnan(modelo.Val));

  1 Comment

Thanks a lot, Madhan Ravi! It worked fine!

Sign in to comment.