I do not not know the input for postgresql, but it should be able to read csv (CSVWRITE) or xls (XLSWRITE) files, right? For a more general delimited file with more control on the format use DLMWRITE.Finally, you might want to have a look at the "Data IO" help page.
You can use PgMex which is an ideal solution for that as it can put Matlab multi-dimensional arrays (hence, vectors and matrices) directly into PostgreSQL arrays of the same type. And it does that 30 times faster and for essentially greater volumes of data than datainsert from Matlab Database Toolbox, see for detailed description of how it may be done and for results of comparison here: https://alliedtesting.github.io/pgmex-blog/2017/06/06/performance-comparison-of-postgresql-connectors-in-matlab-part-I/
PgMex can also very fast extract multi-dimensional data from PostgreSQL (see http://pgmex.alliedtesting.com/#getf), moreover, it can put any Matlab variable into PostgreSQL as BLOB (serialization) and extract such BLOB back back into Matlab workspace (de-serialization).