Insert binary type data into MySQL database
조회 수: 6 (최근 30일)
이전 댓글 표시
Dear all,
I can't figure out how to solve this issue:
I'm using matlab 2012b and my goal is to insert a value into a table's column of a MySQL database. The data type of this column is binary(2). Here you have my code:
conn=database('mysql_labview','','');
address = native2unicode(fliplr(typecast(uint16(hex2dec('0123')),'uint8')));
fastinsert(conn,'my_table',{'address'},{address});
close(conn)
I understand that native2unicode returns a string which is a char type and this is not compatible with column data type. I am able to do this operation in LabVIEW by using the byte array to string function but I need to do this operation in MATLAB too. I would really appreciate your comments and suggestions.
Thanks
Marco.
댓글 수: 2
Guillaume
2015년 2월 9일
I'm not clear on what you're trying to do. What is the data you're trying to write in your column, exactly? Here it looks like it is a single (non-unicode?) character, is that right?
If that is the case, why can't you just write the original bytes in the column?
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Database Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!