Generating pwlech with matlab coder for C language
Show older comments
I am trying to generate c langauge code for two-sided Welch PSD function : [pxx,f] = pwelch(x,window,noverlap,f,fs)
I generated and compiled the code successfully but when I try to run the given example without modifying it in an IDE (codeblocks) I got segmentation fault error specifically in generated function psdfreqvec()
6 Comments
Darshan Ramakant Bhat
on 10 May 2021
It is difficult to answer the question without more context. What is the example you are trying to follow ?
I hope you are following the generated example main() to check the usage of generated code :
Please attach the sample main() function of your application to verify the types of the inputs.
SAAD ELFENNI
on 10 May 2021
Ezra Stein
on 10 May 2021
Thank you for providing us with the MATLAB code. As a first troubleshooting step, could please re-generate the code with runtime checks enabled as described in the link below:
Enabling runtime checks will ensure that the generated code reports runtime issues via a call to 'fprintf' before aborting the program. If runtime checks are not enabled, then a runtime error may manifest as a segmentation fault. Runtime issues usually indicate that the input you provided to the entry point function was somehow ill-formed or unexpected.
If enabling runtime checks does not help resolve the issue, then could you please provide us with the commands you used to generate the code (such as the codegen command and any commands used to prepare a config object or entry point types)?
If you used the MATLAB Coder app to generate the code, could you use the project-to-script feature described in the link below to produce a codegen script and send it to us?
Also, make sure that you call the generated code's terminate function at the end of your main to ensure that the program is terminated correctly. In this case, the terminate function should be called 'DataCalibration_terminate'.
Areej Varamban Kallan
on 11 May 2021
Hi,
Could you please share the inputs x ,fs and dBref that were used.
SAAD ELFENNI
on 11 May 2021
SAAD ELFENNI
on 6 Jun 2021
Answers (0)
Categories
Find more on Algorithm Design Basics 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!