How to remove NaNs from .struct
Show older comments
I have one .struct. Inside this there are 3 different .struct. These .struct have 50-70 different variables (date, time, numbers) (attached here)
I want to remove all the NaNs or replace them with 0 .
Thank you!!
7 Comments
Ashishkumar Gupta
on 5 Jan 2023
Edited: Ashishkumar Gupta
on 6 Jan 2023
Walter Roberson
on 5 Jan 2023
fillmissing() accepts
Input data, specified as a vector, matrix, multidimensional array, cell array of character vectors, table, or timetable.
It does not accept a struct() as its input.
Is there a particular struct field that needs to be examined for NaN?
Or is it the case that you need to examine all of the numeric fields at a given level, find the positions that are NaN in any of the fields at that level, and remove or zero all of the fields at those locations ?
So for example if NSOL(3) is nan and M_SOLL(7) is nan, then Zeit(3) and Zeit(7) should be filled with duration 0 ? and datetime Datum(3) and Datum(7) should be filled with...
datetime(0,0,0,0,0,0)
?
Ashishkumar Gupta
on 6 Jan 2023
Image Analyst
on 6 Jan 2023
@Ashishkumar Gupta you know from your prior question, or at least you should, that you need to attach your structure. Come on, make it easy for us to help you, not hard. Save it to a .mat file and attach it.
If you have any more questions, then attach your data and code to read it in with the paperclip icon after you read this:
Walter Roberson
on 6 Jan 2023
Converting to table is not a bad approach.
Ashishkumar Gupta
on 6 Jan 2023
Answers (0)
Categories
Find more on Structures 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!