how do i give xxx.txt file as input to Embedded Matlab Function in simulink model
2 ビュー (過去 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 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!