Need help to create matlab script to convert currency

22 ビュー (過去 30 日間)
KSK
KSK 2015 年 5 月 27 日
回答済み: Suganthi D 2022 年 3 月 15 日
Dear all,
I need help to write a matlab script to convert and calculate for the currency below. I can't figure out how to write it. Thanks so much in advance!
Convert from SGD to USD GBP EURO from SGD 1 to 25

回答 (2 件)

Nobel Mondal
Nobel Mondal 2015 年 5 月 27 日
Here is function for it : you can easily convert to a script if you want.
function currencyTable = convertCurrency(toUsd, toGBP, toEuro)
SGD = (1:25)';
USD = SGD.*toUsd;
GBP = SGD.*toGBP;
EURO = SGD.*toEuro;
currencyTable = table(SGD, USD, GBP, EURO);
% disp(currencyTable);
end
Then call it from the command prompt or another script:
>> currencyTable = convertCurrency(0.74, 0.48, 0.68)
  13 件のコメント
Nobel Mondal
Nobel Mondal 2015 年 5 月 27 日
If you're using older than R2013b version of Matlab, it might not support table datatype.
KSK
KSK 2015 年 5 月 28 日
編集済み: KSK 2015 年 5 月 28 日
Sorry guys i am using the version R2013a. Below is the error after i click run from the script.

サインインしてコメントする。


Suganthi D
Suganthi D 2022 年 3 月 15 日
how to convert USD value to INR ...pls help me ..i have attached my code here.. These are the USD values 0.0548 , 0.1050,0.1541,0.1050.... IS this correct way to write the currency conversion..
function currencyTable = convertCurrency(toINR)
currencyTable = convertCurrency(0.0548, 0.1050, 0.1541, 0.1050);
INR = USD.*toINR;
currencyTable = table( INR);
disp(currencyTable);
end

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by