Borrar filtros
Borrar filtros

How to acquire individual elements one by one from a workspace row vector in Simulink?

1 visualización (últimos 30 días)
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];
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).
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
  1. Can't access the individual elements of a vector from workspace
  2. Can't set the sampling time for succesful serial transmission

Respuestas (0)

Productos


Versión

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by