How to remove NaNs from .struct
显示 更早的评论
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 个评论
Ashishkumar Gupta
2023-1-5
编辑:Ashishkumar Gupta
2023-1-6
Walter Roberson
2023-1-5
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
2023-1-6
Image Analyst
2023-1-6
@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
2023-1-6
Converting to table is not a bad approach.
Ashishkumar Gupta
2023-1-6
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Structures 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!