Simulink, data from vector representation.

Hi,
I would like to kwon how to import or introduce data in simulink, from a vector which I have got in matlab. I mean, I got tha data from a earthquake wave in a vector in matlab, which I want do is to respresent this vector in simulink, in real time in order to send the data with opc to codesys.
Thanks for your time.

답변 (1개)

Fangjun Jiang
Fangjun Jiang 2020년 7월 21일

0 개 추천

The most common case, let's say you have a vector a=0:0.1:1.
Make it a column vector b=a'
Create a time vector to specify the time for each value, for example, t=(0:10)'
Use the "From Workspace" block, specify the data as [t b], which will give you data value 0 at time 0, value 0.1 at time t=1 second, etc.
There are other format too. Take a look at the Help document of the "From Workspace" block.

댓글 수: 3

Thanks mate, I had checked this, but I have been trying again with this box and finally it works. I have lost almost two ohurs due to the simulation stop time.I had just 10 seconds, and the wave didn't represent correctly. Really thanks. But when I made the sim, the wave is directly draw. I mean, for explample, It doesn't print the date in ten seconds. How can I made as the wave were in real time.
Fangjun Jiang
Fangjun Jiang 2020년 7월 22일
Simulation might be faster or slower than real-time depending on the model. If it is faster, you could slow it down close to real-time. See Simulink Real-Time
Really thanks.

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

카테고리

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

질문:

2020년 7월 21일

댓글:

2020년 7월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by