How to provide input in txt format to a Simulink Model

5 views (last 30 days)
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

Answers (1)

Sara Xie
Sara Xie on 3 Aug 2017
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

Categories

Find more on Prepare Model Inputs and Outputs in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!