Datainsert table with NaN values into SQL table as NULLs

조회 수: 5 (최근 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 CenterFile Exchange에서 Database Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by