Execute S Function Builder Using Windows Subsytem for Linux?
조회 수: 9(최근 30일)
표시 이전 댓글
Andrew Poissant 2019년 8월 14일
답변: Pratyay Pande 2021년 8월 24일
I am trying to integrate C code into my Simulink model using the S Function Builder block. I typically run matlab and Simulink on Windows 10. The C code is for *nix systems, which I have been running on Ubunutu 16.04 via Windows Subsystem for Linux (WSL). However, now I want to integrate the C code into my Simulink model using the S Function Builder block. I keep running into an error when trying to build the S Function saying "fatal error: termios.h: No such file or directory" because termios.h is designed for *nix systems. Is there a way to have the S Function builder block access WSL so I may run this C code in my Simulink model? I have not been able to find a similar header to termios.h for Windows OS.
Pratyay Pande 2021년 8월 24일
A possible workaround is to use Ubuntu 16.04 on a virtual machine, install MATLAB and execute the Simulink model there. I assumed that you are not using any Windows specific functions in your Simulink model. Also, please note that support for Ubuntu 16.04 will be dropped in the upcoming MATLAB release.
The error message may be thrown because termios.h might not have been included in the MATLAB path. Ensure that termios.h is in an accessible location in your filesystem and has been included in the MATLAB path.
As you have mentioned, it may also be the case that termios.h has been designed for *nix systems and contain some dependencies or commands that are specific to Linux systems only. Unfortunately, since S-Function Builder Block cannot access WSL, you will need to include the header file.
Find more on Event Functions 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!