Error using sprintf Function is not defined for 'System.String' inputs.

조회 수: 2 (최근 30일)
filepath = 'D:\OMR_Images\barcode images\060.jpg';
NET.addAssembly('D:\MATLAB Projects\OMR\Barcode Bisegrw.dll');
barcode = Barcode_Bisegrw.Class1.StaticMethod(filepath);
conn = database('OMR','','','Vendor','Microsoft SQL Server','Server','localhost','AuthType','Windows','portnumber',1433);
query = sprintf( 'INSERT INTO tbl_OMR_Rp (barcode) VALUES(''%s'')',barcode);
curs = exec(conn,query );
close(curs);
close(conn);
The variable "barcode" is setting 1x1 System.String in workspace. and its showing correct value in Command Window but i need to send its value into database and its value is like 0 04 461248863 0
  댓글 수: 1
Usama Arshad
Usama Arshad 2016년 4월 16일
i find out the solution just need to change a line in
query = sprintf( 'INSERT INTO tbl_OMR_Rp (barcode) VALUES(''%s'')',char(barcode));

댓글을 달려면 로그인하십시오.

채택된 답변

Usama Arshad
Usama Arshad 2016년 4월 16일
query = sprintf( 'INSERT INTO tbl_OMR_Rp (barcode) VALUES(''%s'')',char(barcode));

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 .NET Data Types in MATLAB에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by