Constant block doesn't accept array

4 ビュー (過去 30 日間)
madhan ravi
madhan ravi 2022 年 8 月 24 日
回答済み: Jim Riggs 2022 年 10 月 28 日
Not sure why the constant block doesn;t give the output as array. Is there any to make it possible?

採用された回答

Paul
Paul 2022 年 8 月 25 日
What is the value of A in the base workspace? Or whatever workspace it lives in.
Note that “A” in the From and GoTo blocks has nothing to do with A in the Constant block.
  3 件のコメント
madhan ravi
madhan ravi 2022 年 8 月 25 日
編集済み: madhan ravi 2022 年 8 月 25 日
Yes , I am aware of it, is there a way possible to use the output in the constant block? It has to take place within the SIMULINK file/model
Paul
Paul 2022 年 8 月 25 日
In the model in the Question, what is the entry for the "Constant value" in the block parameters for the constant block that's feeding Display 1? It looks like it should be 'A', and A must be a variable defined in the base workspace or model workspace (or a mask workspace if that block is masked), and the value of A is 1. That output of 1 is coming from somewhere. But maybe this discussion isn't really relevant to what you want to do.
Do you want the constant block with 'A' to take on the value 2:3 when the simulation is running? If so, why is that second constant block needed at all. Just route the output of the 2:3 block to wherever it needs to go.

サインインしてコメントする。

その他の回答 (2 件)

Jim Riggs
Jim Riggs 2022 年 10 月 28 日
Yes, you can save the value to the workspace and reference it in a constant block. As @Paul points out, the label on the Goto block has nothing to do with the workspace variable name.
The "To Workspace" block saves the variable in structure "Out", and has several options for the variable format.
Below, I show a reference to variable "B" saved to the workspace as an array and as a Time Series. This option is selected in the properties of the "To Workspace" block.

Abderrahim. B
Abderrahim. B 2022 年 8 月 24 日
Hi!
I understood that you want the output of the constant block to have the same size as the array in it.
Use the constant block from DSP System Toolbox/ Sources.
Hope this helps
  5 件のコメント
Abderrahim. B
Abderrahim. B 2022 年 8 月 24 日
Tried at my end.. multiplied the generated const array with its transpose and it worked just fine. What kind of calculations you re doing?
madhan ravi
madhan ravi 2022 年 8 月 25 日

サインインしてコメントする。

カテゴリ

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

タグ

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by