database insert data error
1 次查看(过去 30 天)
显示 更早的评论
Hello everyone, The error I get is that cannot insert element in column 30 because it was expected a double value but instead is []. In Matlab R2016b I did not get this error but in R2017a occured. Please help me to overcome this.
Below is my code:
NEW_DATA1=dataset2cell(NEW_DATA); NEW_DATA1(1,:)=[]; f = @(x)( isnumeric(x) && isnan(x) ); NEW_DATA1(cellfun( f, NEW_DATA1 )) = {''};
%% DATA EXPORT INTO POSTRGE %Make connection to database. Note that the password has been omitted. %Using ODBC driver. conn = database('PostgreSQL30', 'user', 'pswd');
colnames = {'"IDrow"','"VESSEL_NAME"','"DATE"', '"TEL_TYPE"','"LATITUDE_DEG"', '"LONGITUDE_DEG"', '"ROB_FO"', '"LOG_FO"', '"PORT_NAME"', '"ROB_DO"', '"LOG_DO"', '"ROB_GO"', '"LOG_GO"', '"LUBS_ROB_CO"', '"LUBS_ROB_SO"', '"LUBS_ROB_GO"', '"DRAFT_FWD"', '"DRAFT_AFT"', '"ENGINE_RPM"', '"TC_RPM_1"', '"PROPELLER_PITCH"', '"SPEEDLOG_DISTANCE"', '"STEAMINGHOURS"', '"STEAMINGMINUTES"', '"WIND_DIRECTION"', '"WIND_FORCE"', '"SEA_DIRECTION"', '"SEA_FORCE"', '"VESSEL_COURSE"', '"SHORE_FIGURE"', '"BALLAST_FLAG"', '"SUPPLIED_FO"', '"SUPPLIED_DO"', '"SUPPLIED_GAS_OIL"', '"SUPPLIED_CO"', '"SUPPLIED_SO"', '"SUPPLIED_GO"', '"FRESH_WATER_ROB"', '"ETA_NEXT_PORT"', '"MILES_TO_GO"', '"DESTINATION_PORT"', '"AVERAGE_SPEEDLOG_SPEED"', '"ENGINE_MILES"', '"DAILY_LSDO"', '"DRAFT_MID"', '"TOTAL_AVERAGE_RPM"', '"TC_RPM_2"', '"CARGO_TEMP"', '"EXCH_GAS_TEMP_CYL1"', '"PRES_DROP"', '"ME_LOAD_IND"', '"DAILY_BOILER_HSFO"', '"DAILY_BOILER_HSDO"', '"SLOPS"', '"SEA_TEMP"', '"ENGINE_MILES_TOTAL"', '"GMT_TIME_ZONE"', '"FW_PRODUCED"', '"SHIP_FIGURE"', '"SCAV_PRESS"', '"MAX_TEMP_TC_INLET"', '"MIN_TEMP_TC_INLET"'}; data=NEW_DATA1;
datainsert(conn,'"Dan"',colnames,data)
%Close database connection. close(conn);
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Database Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!