Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

export a matrix from Matlab to SQL with correct ype of variables.

조회 수: 1 (최근 30일)
Yogan Sganzerla
Yogan Sganzerla 2020년 10월 29일
마감: MATLAB Answer Bot 2021년 8월 20일
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.

답변 (1개)

Eshaan Shah
Eshaan Shah 2020년 11월 11일
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)

이 질문은 마감되었습니다.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by