insert data to mysql

18 vues (au cours des 30 derniers jours)
Siti Maisarah
Siti Maisarah le 15 Avr 2011
Modifié(e) : John Kelly le 29 Oct 2014
hi there..i really new in matlab.i want to save data in database, where i use mysql as my database.
however, how to connect the query that we have made with the button in gui..for example, button insert.

Réponse acceptée

Walter Roberson
Walter Roberson le 15 Avr 2011
Matt Fig has a good set of example GUI in the MATLAB File Exchange.
Basically, if you want the user to be able to insert arbitrary text, you create an edit uicontrol, and when you want to insert it into the mysql database, you get() the 'String' property of the uicontrol. If you want the user to be able to insert arbitrary numbers, you do much the same, except after you get the String property you validate that it has numbers like you need and then you use a routine such as str2double() to convert the string into numeric values.
  5 commentaires
Siti Maisarah
Siti Maisarah le 16 Avr 2011
if i use this coding
insert(conn,'test',{'aa','bb'},{'hi','hi'})
then hi is successfully insert to mysql..
but when i try to call from the gui which is i use this coding,
insert(conn,'test',{'aa','bb'},{edit1.edit2})
edit1 and edit2 is my textbox in gui, the data not insert in mysql
Siti Maisarah
Siti Maisarah le 16 Avr 2011
succesfull ! thx

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by