Insert binary type data into MySQL database
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Guillaume
el 9 de Feb. de 2015
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?
Respuestas (0)
Ver también
Categorías
Más información sobre Database Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!