MATLAB: Can I use FASTINSERT statement in MATLAB to insert a complex number into the database using Database Toolbox

complexdatabaseDatabase Toolbox

I generate a set of complex numbers in MATLAB which I would like to add to my database. When I try inserting into the database using the FASTINSERT command, I receive the following error message:
Java exception occurred:
java.lang.AbstractMethodError: com.microsoft.sqlserver.jdbc.Parameter.setValue(Lcom/microsoft/sqlserver/jdbc/JDBCType;Ljava/lang/Object;Lcom/microsoft/sqlserver/jdbc/JavaType;Lcom/microsoft/sqlserver/jdbc/StreamSetterArgs;Ljava/util/Calendar;Ljava/lang/Integer;Lcom/microsoft/sqlserver/jdbc/SQLServerConnection;)V
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.setValue(SQLServerPreparedStatement.java:709)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.setTimestamp(SQLServerPreparedStatement.java:1062)
Java exception occurred:
java.lang.AbstractMethodError: com.microsoft.sqlserver.jdbc.Parameter.setValue(Lcom/microsoft/sqlserver/jdbc/JDBCType;Ljava/lang/Object;Lcom/microsoft/sqlserver/jdbc/JavaType;Lcom/microsoft/sqlserver/jdbc/StreamSetterArgs;Ljava/util/Calendar;Ljava/lang/Integer;Lcom/microsoft/sqlserver/jdbc/SQLServerConnection;)V
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.setValue(SQLServerPreparedStatement.java:709)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.setTimestamp(SQLServerPreparedStatement.java:1062)
Error using database/fastinsert (line 243)
Java exception occurred:
java.lang.AbstractMethodError:
com.microsoft.sqlserver.jdbc.Parameter.setValue(Lcom/microsoft/sqlserver/jdbc/JDBCType;Ljava/lang/Object;Lcom/microsoft/sqlserver/jdbc/JavaType;Lcom/microsoft/sqlserver/jdbc/StreamSetterArgs;Ljava/util/Calendar;Ljava/lang/Integer;Lcom/microsoft/sqlserver/jdbc/SQLServerConnection;)V
at
com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.setValue(SQLServerPreparedStatement.java:709)
at
com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.setTimestamp(SQLServerPreparedStatement.java:1062)

Best Answer

Complex number in MATLAB is represented as a 2-tuple number. There is no specific datatype equivalent in database.
However, as a workaround, make the database column datatype as CHAR and insert character equivalent of the complex number by using:
>> charvariable = num2str(complex variable)
Insert this char variable into the database.