通过MATLAB中的Web服务进行货币汇率 [英] Currency exchange rates through a web service in MATLAB

查看:153
本文介绍了通过MATLAB中的Web服务进行货币汇率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获取Matlab中两种给定货币的当前汇率?

How can I obtain the current exchange rate for two given currencies in matlab?

我尝试了一个,但是似乎该Web服务不再可用.

I tried this one, however it seems that the web service is no longer available.

还有另一种简单的方法可以通过matlab中的Web服务获取最新的货币汇率吗?

Is there another easy way of obtaining the up-to-date currency exchange rates through a web service in matlab?

推荐答案

使用 http://www.webservicex.net/上可以使用一种货币转换Web服务(有很多). CurrencyConvertor.asmx?WSDL .这是其用法示例:

Build a local class from a currency conversion web service using CREATECLASSFROMWSDL. You can then use the web service's operations to do the conversion using the class methods. One currency conversion web service (there are many) is available at http://www.webservicex.net/CurrencyConvertor.asmx?WSDL. Here's an example of its use:


>> converter = createClassFromWsdl('http://www.webservicex.net/CurrencyConvertor.asmx?WSDL');
Retrieving document at 'http://www.webservicex.net/CurrencyConvertor.asmx?WSDL'
>> converter = CurrencyConvertor
    endpoint: 'http://www.webservicex.net/CurrencyConvertor.asmx'
        wsdl: 'http://www.webservicex.net/CurrencyConvertor.asmx?WSDL'

>> ConversionRate(converter, 'CAD', 'EUR')

ans =

0.7059

>> ConversionRate(converter, 'USD', 'CAD')

ans =

0.953

请注意,ConversionRate返回一个char数组,即,如果要使用汇率进行计算,则仍然必须用str2double转换结果.

Note that ConversionRate returns a char array, i.e. you still have to convert the result with str2double if you want to do calculations with the exchange rate.

有关货币缩写的列表,请访问 http://www.webservicex .net/ws/wsdetails.aspx?wsid = 10 .

A list of the currency abbreviations is available at http://www.webservicex.net/ws/wsdetails.aspx?wsid=10.

这篇关于通过MATLAB中的Web服务进行货币汇率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆