How Do I send a variable sized array from simulink to matlab workspace (using continuous time and without altering the sample time) ?
5 次查看(过去 30 天)
显示 更早的评论
I have a simulink model and inside that there is a matlab function block which outputs a variable size array. I was able to take care of it by selecting the output variable type as variable in the Port & Data Manager.
Now the To Workspace block throws me an error stating I cannot export a variable sized array. I checked several matlab community posts and tried them too, it didn't work. On top of that I tried this documentation in matlab too - Export Data to MATLAB - MATLAB & Simulink - MathWorks Benelux . It did not work.
Can you please let me know a reliable way to solve this problem ?
0 个评论
回答(2 个)
Poorna
2024-4-2
编辑:Poorna
2024-4-2
Hi Vignesh,
I see you want to export a variable-size output of a matlab function block to workspace as an array using "To Workspace" block. I also see that the system has a continuous sample time.
As of MATLAB R2024a, variable-size signals doesn't support continuous sample time. Also array format logging is not supported for variable-size signals as mentioned in the below documentation: https://www.mathworks.com/help/simulink/ug/variable-size-signal-basics.html
You can check the "Variable-Size Signal Limitations" section in the above link to check out the limitations of variable-size signals.
So, a possible workaround is to compute the maximum range of the the output signal and then make the signal a fixed-size signal with the maximum range as the size. Or you could discretize the sample time and log the signal in Structure/Structure with time/Timeseries using the "To Workspace" block and post process the data to make it an array.
Hope this helps.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Simulink Environment Customization 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!