フィルターのクリア

how do i give xxx.txt file as input to Embedded Matlab Function in simulink model

6 ビュー (過去 30 日間)
Parvathi
Parvathi 2012 年 8 月 11 日
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.

回答 (2 件)

TAB
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.

Konark Kelaiya
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

カテゴリ

Help Center および File ExchangeSimulink Functions についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by