How to read a *.fcf file and add the filter to workspace?

조회 수: 5 (최근 30일)
Mikael Gaspar Martins
Mikael Gaspar Martins 2019년 4월 8일
답변: Ari Mahpour 2020년 12월 2일
Hi everyone!
I'm blocked for already a couple of days on a problem regarding the lecture of a .fcf filter file.
Designing a parametric EQ for shaping a simulated frequency response from audio sound, I need to store a multi-stage filter in a folder for later purposes. This part is complete and working properly. I use the fcfwrite function.
% --- Executes on button press in SaveFilter.
function SaveFilter_Callback(hObject,eventdata,handles)
Hd=getappdata(hObject,'Hd');
prompt = {'How do you want to call the designed multi-stage filter?'};
dlg_title = 'Save the parametric Filter';
num_lines=1;
def = {'sf'};
newname = inputdlg(prompt,dlg_title,num_lines,def);
if isempty(newname)==0
newname=cell2mat(newname);
assignin('base',newname,Hd);
end
% Export filter in the folder paraEQFilter
fcfwrite(Hd,newname);
fileID=(strcat(newname, '.fcf'));
movefile (fileID, 'paraEQFilter');
However, I'm unable to read the file back as I didn't found an opposite function of fcfwrite. Apparently, there isn't a fcfread function.
My questions are:
How can I read the *.fcf file in order to get the filter in the workspace?
If not possible, how can I store a multi-stage direct-form I filter and get it back?

답변 (1개)

Ari Mahpour
Ari Mahpour 2020년 12월 2일
Use the load function but make sure to comment out any non-coefficient lines:
>> load('myfile.fcf')
If you try to load the .fcf file using the load() function with an auto-generated .fcf file you'll likely get an error like this:
Error using load
Unknown text on line number 14 of ASCII file low-pass-5khz.fcf
"Numerator:".
You'll need to either remove that line that says "Numerator:" or comment it out (with a "%").

카테고리

Help CenterFile Exchange에서 Signal Operations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by