Exporting a matrix to Microsoft Access: Error using database/

In summary, the conversation discusses an issue with exporting a matrix from MATLAB to Microsoft Access. The code for the task is provided, along with the error message that is displayed. The solution to the problem is found to be adjusting the settings in Microsoft Access. Once the settings are changed, the program works correctly.
  • #1
Margarett
3
0
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.
[Код]
Q=[];
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
Q(i,j)=A{1,j};
else
Q(i,j)=A{1,j}(1,i);
end
end
end

Q

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

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

Attachments

  • access.jpg
    access.jpg
    33.1 KB · Views: 328
Physics news on Phys.org
  • #2
I found a solution to this problem.
The question is closed.
 
  • #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.
 

What is the process for exporting a matrix to Microsoft Access?

The process for exporting a matrix to Microsoft Access involves first ensuring that the matrix data is in a format that is compatible with Access, such as a CSV or Excel file. Then, the data can be imported into Access using the "External Data" tab and selecting the appropriate file format.

Why am I getting an error when trying to export my matrix to Microsoft Access?

The most common reason for an error when exporting a matrix to Microsoft Access is that the data is not in a compatible format. Make sure to save the matrix data in a format that Access can read, such as CSV or Excel. Additionally, check for any missing or incorrect data that may be causing the error.

How can I troubleshoot an error using the "database/" function when exporting a matrix to Microsoft Access?

If you are encountering an error using the "database/" function when exporting a matrix to Microsoft Access, there are a few steps you can take to troubleshoot the issue. First, check that the database connection is properly established and that the correct database is selected. Additionally, make sure that the matrix data is in a compatible format and that there are no missing or incorrect values.

Is it possible to export a matrix to Microsoft Access with a specific file name or location?

Yes, it is possible to specify a file name and location when exporting a matrix to Microsoft Access. This can be done by selecting the "Advanced" button in the import window and then specifying the file name and location in the "File Name" field. This will allow you to customize the export to your desired file name and location.

Can I export a matrix to Microsoft Access with custom formatting or data types?

Yes, it is possible to export a matrix to Microsoft Access with custom formatting or data types. This can be done by selecting the "Advanced" button in the import window and then specifying the desired formatting and data types in the "Advanced Options" section. This will allow you to customize the export to your specific needs.

Similar threads

  • Programming and Computer Science
Replies
15
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
2
Replies
41
Views
8K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
6K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
Back
Top