Python Block with Vectors: Difference between revisions
Jump to navigation
Jump to search
Mattcarrick (talk | contribs) |
Mattcarrick (talk | contribs) |
||
Line 20: | Line 20: | ||
Modify the following block properties: | Modify the following block properties: | ||
* Signal Source, Frequency: 100 | * Signal Source, Frequency: 100 | ||
* Variable | * Variable | ||
** Id: vectorLength | ** Id: vectorLength | ||
Line 26: | Line 25: | ||
* Stream to Vector, Num Items: vectorLength | * Stream to Vector, Num Items: vectorLength | ||
* Vector to Stream, Num Items: vectorLength | * Vector to Stream, Num Items: vectorLength | ||
* QT GUI Time Sink (both copies), Autoscale: Yes |
Revision as of 13:59, 31 January 2022
This tutorial describes how the Python Embedded Block can be modified to accept vector inputs and outputs, and how the input_items vector indexing is different between vectors and streams.
The previous tutorial, Creating Your First Block, demonstrates how to create a Python block using the Embedded Python Block. The next tutorial, Python Block Message Passing describes how to send and receive messages using the Embedded Python Block.
Building the flowgraph
This tutorial uses vectors, please complete the Streams and Vectors tutorial before moving on.
Add the following blocks to the flowgraph:
- Signal Source
- Throttle
- Stream to Vector
- Embedded Python Block
- Vector to Stream
- QT GUI Time Sink (two copies)
- Variable
Modify the following block properties:
- Signal Source, Frequency: 100
- Variable
- Id: vectorLength
- Value: 16
- Stream to Vector, Num Items: vectorLength
- Vector to Stream, Num Items: vectorLength
- QT GUI Time Sink (both copies), Autoscale: Yes