How to read a *.fcf file and add the filter to workspace?
5 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
回答(1 个)
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 "%").
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!