How to populate matlab GUI edit texts with values from MySQL database?
1 次查看(过去 30 天)
显示 更早的评论
I have created a table with 10 columns in MySQL and manage to connect it with Matlab. What is the code to retrieve those data and display them in a matlab GUI edit texts boxes?
2 个评论
回答(1 个)
Piyush Kumar
2024-10-21
Hi,
If you have created the edit text box using uicontrol, you can use the set function to display the value extracted from the database.
For example,
fig = figure('Position', [100, 100, 300, 200], 'Name', 'Simple GUI');
% Create an edit text box
editText = uicontrol('Style', 'edit', ...
'Position', [50, 100, 200, 40], ...
'String', 'Default value');
% db_value = fetch(conn, sqlquery) % Replace conn and sqlquery with the correct values
db_value = 'Hi, I am from db'
% Set the string value of the edit text box
set(editText, 'String', db_value);
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!