【发布时间】:2021-10-04 20:28:53
【问题描述】:
我正在使用sqlwrite 尝试将表写入 PostgreSQL 数据库。据我了解,Postgres 支持 Array 类型。
我要插入的表有两列 x 和 y,其中列 x 的条目本身就是 1xN 数组。
T = struct;
T.x = [[1 2 3 4 5 6 8 8 9 10]];
T.y = "test_string";
T = struct2table(T);
sqlwrite(conn, 'my_table', matlabTable);
T看起来像这样
T =
1x2 table
x y
_____________ _____________
[1x10 double] "test_string"
这是我尝试运行代码时遇到的错误
Error using database.postgre.connection/sqlwrite>checkDataTypes (line 315)
x column value must be a numeric array or cell array of numeric scalars.
Error in database.postgre.connection/sqlwrite (line 155)
data = checkDataTypes(typNames,typeCategories,data);
这是 MATLAB 的 sqlwrite 的限制还是我做错了什么?
谢谢。
【问题讨论】:
标签: arrays database postgresql matlab