how do i give xxx.txt file as input to Embedded Matlab Function in simulink model
조회 수: 6 (최근 30일)
이전 댓글 표시
Hi,
I am new to Simulink. I have written a function in matlab, which converts text to binary. Now i want to include this function in my simulink model. I can use Embedded Matlab Function block to do this. Since the input to this block is a txt file, i do not know how to feed it.
Please help me.
Thanks Parvathi.
댓글 수: 0
답변 (2개)
TAB
2012년 8월 13일
편집: TAB
2012년 8월 13일
Simulink can not use text file as input.
You can use matlab functions like fopen, fread, fclose in simulink inside Matlab function block declaring them as extrinsic to read/write text file.
But it is inefficient and not a good idea to read or write text or binary files from simulink. Instead you can use matlab script for this purpose. If some data is needed from simulink, save/log the data in the base workspace and use it in the m-script.
댓글 수: 0
Konark Kelaiya
2012년 8월 13일
Yes..
Make MATLAB function script file to read the data from xxx.txt file , wherein there are lots of handy function which can read the data from text.
Later on save those data to workspace or file as mat and add simulink block either i/p from workspace / i/p from file to get those data into simulink.
more, using extrinsic in MATLAB simulink function doesn't work for all the function available within MATLAB toolbox
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Simulink Functions에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!