Function inside a for loop

1 回表示 (過去 30 日間)
Ben Jones
Ben Jones 2020 年 3 月 18 日
コメント済み: Sriram Tadavarty 2020 年 3 月 18 日
Hi there. I am new to Matlab, and I need to perfom a function on an array of audio files utilising the MIR toolbox
I know that what I have will not work, how would I go about correcting this? many thanks
fileNameArray = ["Gnarles Barkley - Crazy.mp3"];
result = [];
i=1;
for i =1:1
fileNameArray(i);
result(i) = function e=mirrms(fileNameArray);
i = i + 1;
end

採用された回答

Sriram Tadavarty
Sriram Tadavarty 2020 年 3 月 18 日
編集済み: Sriram Tadavarty 2020 年 3 月 18 日
Hi Ben, Directly use result(i) = mirrms(fileNameArray(i)) would help. Regards, Sriram
  2 件のコメント
Ben Jones
Ben Jones 2020 年 3 月 18 日
Ah thankyou, that seems to be working although as the output for the function is:
"The RMS Energy for the file is... 0.456"
The result in matlab = NaN unfortunately :(
Sriram Tadavarty
Sriram Tadavarty 2020 年 3 月 18 日
I am not sure what mirrms function do. So cant help much. If the above solved the purpose, accept it, and may be you can start a new thread for the difficulty faced.

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by