Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Exporting a matrix to Microsoft Access: Error using database/

  1. Nov 27, 2018 #1
    Hello! Below is the code for the following task:
    • matrix "Q" with a dimension of 3*2 was obtained using a matrix of cells "A";
    • then the matrix "Q" is exported to Microsoft Access with the same dimension (3 rows, 2 columns).
    (!) The difficulty is that only the first row of the matrix is written to Microsoft Access (of the three available) and then an error message is displayed:
    • Error using database/insert (line 213) General error
    • Error in test_matlab (line 22) insert(conn, 'Rtu', colnames, Q);
    (?) Tell me, please, how is it necessary to add / correct the code in order to record all three rows of the matrix in Microsoft Access?
    • I use matlab version R2014b.
    • Below there is an archive with files.
    • I am using the matlab version R2014b.
    • Below is an archive with files.
    A={1, [3 5 8]} % array of cells

    for j=1:2 % matrix column index
    for i=1:3 % matrix row index
    if j==1


    conn = database('QWERT', '', '');
    colnames = {'u1', 'u2'};

    insert(conn, 'Rtu', colnames, Q);
    [/ код]

    Attached Files:

  2. jcsd
  3. Nov 28, 2018 #2
    I found a solution to this problem.
    The question is closed.
  4. Nov 28, 2018 #3
    If someone is interested to know the cause of errors, the reason is as follows.
    The code was correct.
    The problem was in the settings of Microsoft Access.
    It was necessary to specify in the settings of Microsoft Access "Сoncordance of Element are allowed".
    Before this was specified in the settings "Сoncordance of Element are not allowed".
    In result, the program began to work correctly after changing the settings.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Have something to add?