Insert binary type data into MySQL database
5 ビュー (過去 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!