Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
export a matrix from Matlab to SQL with correct ype of variables.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Dear all,
I have a code that Is attached which the aim is to create a matrix with specific type of variable in each Column.
The code is working perfectly and it is saving the matrix in my data base. However, as you can see in the image below, the type of the variable is missing. For example the id should be real nunbers i.e.[1;2;3;4..]
How can I define this parameter in Matlab? I already tryed to define the first colums as reeal but when I export to SQL it change again.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/396328/image.png)
0 Kommentare
Antworten (1)
Eshaan Shah
am 11 Nov. 2020
Hi,
The function sqlwrite provides a way to specify column types when inserting data into a table. Please refer to this example from the sqlwrite doc.
From the example:
tablename = 'toyTable';
coltypes = ["numeric" "numeric" "numeric" "numeric" "varchar(255)"];
sqlwrite(conn,tablename,data,'ColumnType',coltypes)
0 Kommentare
Diese Frage ist geschlossen.
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!