Remove NaN values from a table

33 ビュー (過去 30 日間)
Ines Shekhovtsov
Ines Shekhovtsov 2023 年 4 月 3 日
コメント済み: Peter Perkins 2023 年 4 月 5 日
Hi,
I have an 84 column table that has EMG, gyroscope, goniometer and analog signal data. It was all collected at different frequencies and there are NaN values for rows that were sampled at lowest rate so that they match the column with largest amount of actual data. I just want to remove these NaN values so that i have a new table with columns of varying length that have actual data, and thus no NaN values. So to just further clarify, lets assume column 1 is emg and has 1000 data points and 200 NaN values, column 2 is gyroscope data so that has 300 data points and 900 NaN values, column 3 is goniometer data that has 400 data points and 800 NaN values and finally column 4 has analog data that contains no NaN values and has 1200 actual data points.
I would like to just remove the NaN values from the table so that column 1 now has 1000 data points, column 2: 300 data points, column 3: 400 data points and column 4 still the original 1200 data points.
can someone please help me out with this?
Thank you in advance!

回答 (2 件)

Image Analyst
Image Analyst 2023 年 4 月 3 日
All columns in a table must be the same number of rows. To have what you want, you'd have to break apart your table into 4 (or 84) separate tables (or double vectors).
  2 件のコメント
Ines Shekhovtsov
Ines Shekhovtsov 2023 年 4 月 3 日
I've been trying to code by minimizing creating variables in the workspace and storing them in structs instead. HOwever i'm just familiarizing myself with structs. Could someone show me how to do a simple struct based on the example information i have given?
Thank you
Image Analyst
Image Analyst 2023 年 4 月 3 日
Maybe, but yoiu keep forgetting to attach your data. I'll check back later for it.

サインインしてコメントする。


Star Strider
Star Strider 2023 年 4 月 3 日
I would not remove the NaN values.
The fillmissing function using the 'previous' method might be the best option.
  1 件のコメント
Peter Perkins
Peter Perkins 2023 年 4 月 5 日
Right, as SS says, you should thiknk about why you want to do this. Your life might be easier if you did not. Hard to tell though, you would need to say what happens to these data down the road.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by