How to provide input in txt format to a Simulink Model

3 次查看(过去 30 天)
Hi,
Is it possible to provide input data to a Simulink Model in txt format? If so, how can I do this? I'm using Matlab/Simulink R2015b 64-bit.
Thanks, Portolon

回答(1 个)

Sara Xie
Sara Xie 2017-8-3
Hi Tiago,
As I understand you are trying to load data in .txt file into Simulink model. The function textscan should be able to do this for you, it reads data from an open text file into a cell array. You can try put this function call into the model callbacks, for example 'PreLoadFcn' or 'InitFcn'. Check the documentation of model callbacks for how to use it.
To learn more about import txt file into MATLAB, check the domumentation of Ways to Import Text Files

类别

Help CenterFile Exchange 中查找有关 Programmatic Model Editing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by