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

Exactly what kind of database do you have? Like Oracle, Microsoft Access, or whatever? Do you have the Database Toolbox?

댓글을 달려면 로그인하십시오.

답변 (1개)

Voss
Voss 2022년 6월 11일
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
Choose one of the following: 0: To exit 1: To enter a new customer 2: To enter a new employee 3: To add a new property 4: To book a new inspection 5: Assign a Customer to a booking 6: Print all current inspections 7: Print all current customers 8: Print the list of all properties 9: Visualizes the distribution of property price
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.)

카테고리

질문:

2022년 6월 11일

답변:

2022년 6월 11일

Community Treasure Hunt

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

Start Hunting!

Translated by