How can I graph data from a database in my program
Show older comments
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 Comment
Image Analyst
on 11 Jun 2022
Exactly what kind of database do you have? Like Oracle, Microsoft Access, or whatever? Do you have the Database Toolbox?
Answers (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.)
Categories
Find more on Database Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!