Wrong sized array from "To workspace"

7 ビュー (過去 30 日間)
Anne
Anne 2023 年 7 月 16 日
回答済み: Ali Hussein Numan 2025 年 7 月 16 日
Hello!
I am interested in using several arrays in a Matlab code. Thus, I used the "to workspace" block to convert signal values to arrays. I used the settings:
However, for some reason, I got two arrays with different dimensions:
What should I do to have correctly sized arrays?
  3 件のコメント
Paul
Paul 2023 年 7 月 17 日
I think that, unless the To Workspace block is actually inside a conditionally executed subsystem, the only thing that matters is the sample time of the signal input to the To Workspace block, becasue the Sample time paramater of the To Workspace block is set to -1 (inherited).
Anne
Anne 2023 年 7 月 18 日
I find it a little bit weird because that longer array is the integration of this shorter array. Otherwise I wouldn't say that there are any conditions.

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

採用された回答

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2023 年 7 月 17 日
Are you using a variable step solver in your model? If so, you'd need to change it to a fixed step solver.
  3 件のコメント
Anne
Anne 2023 年 7 月 18 日
I tried to change the sample time to the exact simulation sample time value and it looks like it worked and got an equally shaped array.
Sulaymon Eshkabilov
Sulaymon Eshkabilov 2023 年 7 月 18 日
You'd accept the answer :)

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

その他の回答 (1 件)

Ali Hussein Numan
Ali Hussein Numan 2025 年 7 月 16 日
Use fixed step solver instead of variable step solver. The data to workspace will be with the same lengnth

カテゴリ

Help Center および File ExchangeProgrammatic Model Editing についてさらに検索

タグ

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by