Saving filter coefficients from the Filter Visualization tool
6 views (last 30 days)
Show older comments
MathWorks Support Team
on 4 May 2023
Answered: MathWorks Support Team
on 4 May 2023
I have opened a filter in the Filter Visualization tool. I can view the filter coefficients but am not able to save the coefficients to a file. How can I accomplish this workflow in R2023a?
Accepted Answer
MathWorks Support Team
on 4 May 2023
As of R2023a, the Filter Visualization tool does not directly support exporting the filter coefficients.
As a workaround, you can use the ‘coeffs’ function to store the coefficients to a workspace variable and then use the ‘writematrix’ function to write the stored coefficients to a file.
As an example, suppose you want to save the coefficients of the shipped filter 'dsp.CICCompensationInterpolator'. The filter coefficients can then be saved to a file using following code snippet:
storedCoefficients = coeffs(dsp.CICCompensationInterpolator); %extract the filter coefficients as structure
writematrix(storedCoefficients.Numerator,'CoefficientData.txt'); %save the numerator coefficients to a text file
This code snippet will save the filter coefficients in a text file ‘CoefficientData.txt’ (you can choose any file formats as per your requirement). Please refer to the following documentation on ‘writematrix’ function for more information:
For more information on the ‘coeffs’ function, please refer to the following documentation:
0 Comments
More Answers (0)
See Also
Categories
Find more on Filter Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!