Import Workspace Data - Lookup Table vs. From Workspace?

5 ビュー (過去 30 日間)
Ethan Ott
Ethan Ott 2011 年 5 月 4 日
In some models I use the from-workspace block as usual create simulink signals based on workspace data. I have also used a 1D Lookup-table block to accomplish the same thing by attaching a clock block to the table input and configuring the table with the time vector as input values and the signal data as the output values.
Is either method more efficient? What are the pro/cons for each method?
I think I started using the Lookup-tables because the workspace data (time and signal vectors) were not always oriented as a column vector as the from-workspace block requires.
-Ethan

回答 (1 件)

MarkB
MarkB 2011 年 5 月 5 日
As a third method, I would propose using an inport, and then specifying a workspace variable using the "Import/Export" section of the Configuration Parameters to specify a MATLAB workspace variable to read as an input.
This has several advantages over the other approaches. For both of the other options, if you place the model inside of a larger model reference hierarchy, you will find yourself locked into using the same workspace variable for every instance. By using an input port, on the other hand, the data will come from whatever signal line is connected to it, making each instance more flexible.
Also, any signal-based inputs can be driven by a Signal Builder block further upstream. This provides a much easier way to coordinate changes in the signal's value with other signals if there are timing dependencies.

カテゴリ

Help Center および File ExchangeSignal Attributes and Indexing についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by