Removing rows with empty values in table

56 ビュー (過去 30 日間)
Tanika Bawa
Tanika Bawa 2022 年 9 月 26 日
回答済み: George Papazafeiropoulos 2022 年 9 月 26 日
Hello! I have the table attached ('egAllHitMov') which has missing values in the first 6393 rows showing as []. I tried the following line to remove them:
AllHitMov = rmmissing(AllHitMov);
But it does not work, and also does not give me an error. Do you know how I can create a new table without these lines?
Thank you!

採用された回答

Cris LaPierre
Cris LaPierre 2022 年 9 月 26 日
Empty is not a recognized missing value in MATLAB, so rmmissing does nothing.
Missing values are defined according to the data type of A:
  • NaN double, single, duration, and calendarDuration
  • NaT datetime
  • <missing> string
  • <undefined> categorical
  • {''} cell of character vectors
I think the easiest way to do what you want is to convert your values from empty cell arrays to doubles. That automatically removes the empty rows.
AllHitMov = varfun(@cell2mat,AllHitMov);
  1 件のコメント
Tanika Bawa
Tanika Bawa 2022 年 9 月 26 日
Thank you very much for the answer but also for the explanation =)

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

その他の回答 (1 件)

George Papazafeiropoulos
George Papazafeiropoulos 2022 年 9 月 26 日
AllHitMov(1:6393,:)=[];

カテゴリ

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

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by