How can I graph data from a database in my program
显示 更早的评论
Hi, Confused on how I would get data from my database (in this case im trying to graph the property price, with price as the Y axis and the adress as the X axis). I am not quite sure how to retrive this data from the data base. it is option 9 in the program I have attached. Thanks
1 个评论
Image Analyst
2022-6-11
Exactly what kind of database do you have? Like Oracle, Microsoft Access, or whatever? Do you have the Database Toolbox?
回答(1 个)
property.propertyprice and property.Address are both strings. It's possible to remove the $ and , characters from the prices and then convert the prices to numbers, but it's not clear how the addresses should be used in the plot, so here I've just made a plot of each property's price and labeled the xticks with the addresses.
Project2v2_2
Take a look at the attached code in the option == 9 block and see if you can adapt it as necessary.
(FYI, to get the code to run here, I removed the input call and hard-coded option = 9 and also put a break statement at the end of the while loop so it would stop after making the plot.)
类别
在 帮助中心 和 File Exchange 中查找有关 Database Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
