How to acquire individual elements one by one from a workspace row vector in Simulink?
2 次查看(过去 30 天)
显示 更早的评论
Objective
I have accessed a row vector, x, from workspace using "From Workspace" block in Simulink. Now I am trying to access the indivdual elements of that array and send them serially to F28379D microcontroller from Texas Instruments, which will multiply them with a gain and send them back for viewing on a scope.
Problem
I can't access the individual elements of the row vector in such a way that individual elements are available for sending through a serial port.
Here's what I've tried:
Attempts
Using a For Iterator to generate the index number, I tried to access the vector element at that index and send it to the serial port.
The data vector is defined as x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/656770/image.jpeg)
It gives following error:
'SimpleVectorRead/For Iterator Subsystem/Serial Configuration' has sample time 0. Only constant (inf) or inherited (-1) sample times are allowed in iterator subsystem 'SimpleVectorRead/For Iterator Subsystem'.
But the problem is that the Serial Configuration block doesn't have sample time to set.
I tried the lookup table approach with the same serial configuration block (not shown here).
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/656775/image.jpeg)
And I got the following error:
Error evaluating registered method 'Start' of MATLAB S-Function 'sserialsb' in 'MatFileReadWrite_SerialCom_HostModel/Serial Send1'.
Caused by:
- The block 'Serial Send1' cannot be assigned a continuous sample time.
Main issues
- Can't access the individual elements of a vector from workspace
- Can't set the sampling time for succesful serial transmission
0 个评论
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!