MATLAB可以检索在线数据吗? [英] Can MATLAB retrieve online data?
问题描述
我有一个即将到期的最终项目,必须创建一个建筑计算器GUI.
I have a final project due soon and am having to create a building calculator GUI.
输入为
- 楼层数
- 浴室数量和
- 平方英尺
产出应为建造房屋的材料成本.
The output shall be the cost in materials to build the home.
我的目标之一(可以通过TA告诉我是可行的,后来我更深入地了解后他似乎并不了解很多)是自动更新网站上每种材料的成本,例如每次运行GUI时都作为Home Depot的.建筑材料成本经常变化,因此我想为每种材料分配自己的成本值,该值可以从HD网站上自动更新.这有可能吗?
One of my goals (which I was told by my TA was doable, then he seemed to not know much about after I went more in depth later) was to automatically update the cost of each material from a website such as Home Depot's each time the GUI is run. Building material costs change frequently so I wanted to assign each material its own cost value that is updated automatically from HD's website. Is this something that is possible?
我非常感谢您的投入.
RockPrice = urlread('http://www.homedepot.com/p/SHEETROCK-UltraLight-1-2-in-x-4-ft-x-8-ft-Gypsum-Board-14113411708/202530243','Get',{'displayPrice','urlread'})
推荐答案
For getting a webpage's content (including all markup), urlread
can be used. Parsing that string for the data you want ('scraping' it, as some like to call this process) might be non-trivial in MATLAB, though.
更容易处理的是来自专用API的数据,并且Home Depot 似乎实际上拥有具有产品详细信息的REST API .不过,他们所有的公共API似乎仍处于私有Beta中,所以我不知道一个人请求API密钥会有多成功.
Easier to handle would be data from a dedicated API, and Home Depot seems to actually have a REST API that has their product details. All their public APIs seem to still be in private beta, though, so I don't know how successful one would be in requesting an API key.
这篇关于MATLAB可以检索在线数据吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!