Function definitions in a script must appear at the end of the file. Move all statements after the "bandstop2" function definition to before the first local function definitio

6 ビュー (過去 30 日間)
Sherif Aly
Sherif Aly 2022 年 4 月 23 日
回答済み: Voss 2022 年 4 月 23 日
%code for IIR filters and output plot
clear all
[Input, Fs]=audioread('cameraclicks.mp3');
Output1=filter(bandstop1,Input);
Output2=filter(bandstop2,Output1);
audiowrite('filteredcameraclicks.mp3',Output2,Fs);
  2 件のコメント
Voss
Voss 2022 年 4 月 23 日
This code snippet contains no function definitions. Please share the complete contents of the m-file where the function bandstop2 is defined. (You can upload the m-file by clicking the paperclip button.)

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

回答 (1 件)

Voss
Voss 2022 年 4 月 23 日
@Sherif Aly Thank you for the m-file. That's a script, and like the error message says, function definitions in scripts must be at the end of the file. (In this case, each function was defined two times, which is not allowed. They were duplicates of each other, so I commented out the duplicate functions.) I moved the function definitions to the end of the file; the new file is attached.

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by