Reading formatted text file in simulink

I have a Simulink model and I need to read a bunch of strings from an ascii text file. I wrote a Matlab script and found using the textscan function works well. However, when I tried creating a MATLAB function block in my model with the code, I get the following error: 'Function 'textscan' is not supported for code generation.
The only direct file input into Simulink I could find is the From File block, however I do not have a .mat file.
Is there a better way to read text files in Simulink? How can I work around the textscan error?
I'm fairly new to Simulink. Running version R2016a.

답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2016년 6월 13일

0 개 추천

add to your function
coder.extrinsic('textscan')

댓글 수: 1

John Michel
John Michel 2016년 6월 13일
Thank you. That does work but eventually I would like to do code generation on this model so I am wary of using this solution.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Programmatic Model Editing에 대해 자세히 알아보기

제품

질문:

2016년 6월 13일

댓글:

2016년 6월 13일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by