Question: MATLAB App Designer - please help me find what is causing me to not get a numerical value for app.Label_2.Text % Callbacks that handle component
\% Callbacks that handle component events methods (Access = private ) \% Button pushed function: ConvertButton function ConvertButtonPushed (app, event) usdAmount = str2double (app.AmountEditField.Value); selectedCurrency = app. CountryDropDown. Value; exchangeRate = getExchangeRate (selectedCurrency); convertedAmount = usdAmount exchangeRate; app.Label_2.Text =sprintf(%0.2f%s, convertedAmount); function rate = getExchangeRate (currency) switch currency case ' JPN ' rate =1.5 case ' CNY ' rate =5.0; case 'CAN' rate =0.9; case 'MEX' rate =2.0; otherwise rate =1.0; end end
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
