Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I'm trying to make an app in MATLAB's app designer that pulls values of current exchange rates from online sources, but the url shown below
I'm trying to make an app in MATLAB's app designer that pulls values of current exchange rates from online sources, but the url shown below doesn't seem to work for me and I do not know how I would be able to import these values to begin with. The function for getExchangeRate has filler values that I would like to have be replaced with the values that get updated consistently.
% Button pushed function: ConvertButton function ConvertButtonPushed(app, event) USDAmount = app.AmountEditField.Value; selectedCurrency = app.CurrencyDropDown.Value; exchangeRate = getExchangeRate(selectedCurrency); convertedAmount = USDAmount exchangeRate; app.Label_2.Text =sprintf(%0.2f%s, convertedAmount, select % % % % % % % % % % url = 'https://wWW.x-rates.com/table/?from=USD\&amount=1'; htmlContent = webread(url); currencyPattern = '>span class=" currency-value" >(. ? ) span>' currencyMatches = regexp(htmlContent, currencyPattern, 'tokens usdValue = str2double (currencyMatches {1}{1}); eurValue =str2 double ( currencyMatches {2}{1}); convertedAmount = convertCurrency (app, USDAmount, selectedCurr function rate = getExchangeRate(currency) switch currency case 'EUR ' rate=0.91795; case 'GBP' rate=0.78917; case 'INR ' rate=83.0166; case 'AUD' rate=1.49196; case 'CAD' rate=1.33729; case 'SGD' rate=1.33327; case 'MYR' rate=4.67098; case 'CHFStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started