Import Matlab matrix to Simulink

43 ビュー (過去 30 日間)
Santos García Rosado
Santos García Rosado 2021 年 3 月 10 日
Hello community,
I'm trying to input a matrix variable saved from my matlab workspace into Simulink as an Input. The dimensions of my matrix are 14x262801. I'm using the From workspace block but for some reason it only outputs the last row of my matrix variable (size 1x262800).
Could someone explain me how to solve this problem and get the whole Matrix? I've tried changing some parameters from the block but I still can't manage to get the expected output.
Thank's for the help!
Santos
  2 件のコメント
Fangjun Jiang
Fangjun Jiang 2021 年 3 月 10 日
use a samll matrix as an example, explain how you did it and what is your expectation
Santos García Rosado
Santos García Rosado 2021 年 3 月 10 日
First of all, thanks for your help and time.
This is the Matrix I have in my workspace in Matlab:
MyMatrix = [0,1,2,3,4,5; 0,6,7,8,9,10; 0,11,12,13,14,15]
Then, I'm using the From Workspace block and writting the name of my variable "My Matrix"on the Data box.
The Output I'm expecting from that block in simulink is:
ExpectedOut = [1,2,3,4,5; 6,7,8,9,10; 11,12,13,14,15]'
However I'm getting the output of only the last row:
RealOut = [11,12,13,14,15]'
I'm not using Simulink for time simulations so I don't need a time vector. This is the reason why I write a zero at the beggining of each row.
Hope I made my self clear.
Thank you,
Santos

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

採用された回答

Fangjun Jiang
Fangjun Jiang 2021 年 3 月 10 日
  1 件のコメント
Santos García Rosado
Santos García Rosado 2021 年 3 月 10 日
Thank you Fangjun! Nice and easy example! My code is working great now.
Just out of curiosity, why does t1 = 0.2 * [0:49]'; have to go from 0 to 49 and with that step in between? I've been trying the simulation with different steps a ranges and still works for me. What are the differences between using one step or another?
Thank you again for all your help.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSources についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by