MATLAB Answers

To Workspace overwriting each timestep

4 ビュー (過去 30 日間)
daniel doscher
daniel doscher 2019 年 4 月 26 日
コメント済み: Daniel Doscher 2019 年 4 月 26 日
I am running a simulation in simulink and I have a 'to workspace' block that feeds of of a vector signal and is supposed to output an array. I have used this feature in this same model before and havent had any problems. However in this current model the workspace variable only has one row (or one time stamp worth) of values, as if the 'to workspace' block is overwriting the same row over and over. I know the values are changing in the simulation as seen in scopes that are reading the same signal. Does anybody have any ideas on how I can pinpoint this problem?
Attached is the Simulink File and an m file which initialized the variables. It uses some hardware from Quanser so a lot will have to be muted for it to run without.

  3 件のコメント

Bob Nbob
Bob Nbob 2019 年 4 月 26 日
I haven't worked in Simulink hardly at all, but with regular Matlab I would think that you haven't indexed the output somewhere. Is that maybe your problem?
Fangjun Jiang
Fangjun Jiang 2019 年 4 月 26 日
attach your model or make a simple example to show the problem
daniel doscher
daniel doscher 2019 年 4 月 26 日
It seems like thats whats happening but every other time I have used this function it takes care of the 'looping' internally.

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

回答 (1 件)

Sara Nadeau
Sara Nadeau 2019 年 4 月 26 日
Hi Daniel,
I poked around your model a bit. Are you intending to save data_theta_both and data_alpha_both in different formats? The data_theta_both To Workspace block is saving in Timeseries format - which might be the behavior you're seeing? The variable would show up in the workspace as '1x1 timeseries object'.

  1 件のコメント

Daniel Doscher
Daniel Doscher 2019 年 4 月 26 日
This is something I did while I was debugging. Ive always had them saved as arrays but tried saving as timeseries for one of them to see what would happen. Usually when I save as array in other simulink models I do not encounter this problem. as of now, data_alpha_both and data_theta_both are ending up as a single row matrix

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by