How can S-function builder work with fixed point inputs and outputs?
3 views (last 30 days)
Show older comments
Hi,
I'm using MATLAB R2017a with Windows 10 64 bits. The compiler installed in the computer is MinGW64 Compiler. Then, my objective is to use S-function builder with inputs and outputs as fixed point variables. I want to use the different functions compiled in the libfixedpoint.lib library as, for example, trigonometric functions.
The data type of input u0 and output y0 are defined as fixed-point binary point scaling with the word length as 32 bits and the fraction length as 21 bits. The output code is very simple: y0[0] = u0[0]. When I click the Build bottom the next message appears: "gcc:error:libfixedpoint.lib: No such file or directory"
In the Libraries pane I have wrotten the next command (inside the Library/Object/Source files (one per line) window): LIB_PATH C:\Program Files\MATLAB\R2017a\extern\lib\win64\microsoft\libfixedpoint.lib. But I look for this file in the computer and the path it is correct.
Finally, which is the procedure to configure the S-function builder block working with Fixed-Point Variables?
0 Comments
Answers (1)
Gillian Rosen
on 27 Sep 2017
Hi Carlos,
I understand that you are creating an S-Function using the S-Function Builder block with fixed-point inputs and outputs. You are getting an error when you try to build that the 'libfixedpoint.lib' library cannot be found, and you would like to know what you need for configuring the S-function builder to use fixed-point variables.
For the build error, the following troubleshooting questions may help narrow down the issue:
1. Are you able to include other libraries from this folder?
2. Are you able to include libraries from other locations, such as your current folder?
3. Are you able to include source/object files without error?
When you set the data types of the input and output to a fixed-point type, the S-Function builder will automatically add the appropriate #include directories for working with fixed-point variables to the generated S-Function. You can open the generated S-Function file and see that they have been added as indicated in the following documentation page:
2 Comments
Gillian Rosen
on 28 Sep 2017
The S-Function Builder block is only able to create C-MEX S-Functions, so you will need to use C code inside this block.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!