Function inside a for loop

조회 수: 2 (최근 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 CenterFile Exchange에서 Programming에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by