Simulink vector to scalar stream

I have a fixed-step (1ms) project. I have a block outputting a 7680x1 vector every 1ms. This output feeds a subsytem that does not accept vector input. Only scalar. So its giving a compile error. What can I do?

답변 (1개)

Ameer Hamza
Ameer Hamza 2020년 4월 21일

0 개 추천

See from workspace block: https://www.mathworks.com/help/releases/R2020a/simulink/slref/fromworkspace.html. Create a matrix with two columns in the MATLAB workspace. The first column is the time value, spaces by 0.001 seconds, and the second column is data. This block will read the data, one value at a time.

댓글 수: 5

yazz.jazz
yazz.jazz 2020년 4월 21일
Thanks. Is it possible to increase the sampling rate of the vector input to the subsystem. say to 1us instead of 1ms?
Ameer Hamza
Ameer Hamza 2020년 4월 21일
Do you want to resample the signal? Currently, you have 7680 samples, do you want to create 7680000 samples with 1us sampling period?
yazz.jazz
yazz.jazz 2020년 4월 21일
I'm feeding 7680 samples into a subsystem every 1ms. The subsystem does not accept vector inputs. It can only take single values at a time. So I'd like to somehow serialize and feed these 7680 samples into the subsystem. Also I dont want to feed one sample every 1ms. I'd like to feed at a faster rate.
Ameer Hamza
Ameer Hamza 2020년 4월 21일
The "from workspace" block serialize the vector to give one value at each time interval. You can change the first column of the input matrix to specify whatever time-sample you want.
bitec bit
bitec bit 2021년 4월 29일
편집: bitec bit 2021년 4월 29일
hello Ameer!
i have a question here (i am facing this problem), what if the block which doesnt accept the vector is going to be a switch?
Thanks!

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Event Functions에 대해 자세히 알아보기

제품

질문:

2020년 4월 21일

편집:

2021년 4월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by