フィルターのクリア

Datainsert table with NaN values into SQL table as NULLs

9 ビュー (過去 30 日間)
Olivia
Olivia 2016 年 8 月 15 日
コメント済み: Ledger Yu 2019 年 1 月 8 日
Dear Sir/Madam,
I have a matlab table with 2 numeric columns. Some values in the table are NaN. What is the best way to get these values to appear as NULL when inserted in SQL? I have been using datainsert and repeatedly get errors, even though NullNumberWrite='NaN'.
Any help would be much appreciated.

回答 (1 件)

Bhavesh Bhatt
Bhavesh Bhatt 2016 年 8 月 16 日
I hope this helps -
a=[NaN,1,2,3,NaN,2,3,4,3,4,4,4,4,5,32]';
To delete the NaN entry, please type the following commands in the MATLAB command window -
>> a(isnan(a))=[];
To replace the NaN entry with 0, please type the following commands in the MATLAB command window -
>> a(isnan(a))= 0;
  1 件のコメント
Ledger Yu
Ledger Yu 2019 年 1 月 8 日
OP is asking about how to insert those rows with NaN values, not removing them or replacing them. Those NaN values should still be inserted.

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

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by