0

I am using this snippet in order to create a mf4 file with a value to text table, found in the examples from asammdf's github.

vals = 5
conversion = {
    'val_{}'.format(i): i
    for i in range(vals)
}
conversion.update(
    {
        'text_{}'.format(i): 'key_{}'.format(i).encode('ascii')
        for i in range(vals)
    }
)

sig = Signal(
    np.arange(cycles, dtype=np.uint32) % 30,
    t,
    name='Channel_value_to_text',
    conversion=conversion,
    comment='Value to text channel',
    )
sigs.append(sig)

mdf.append(sigs, comment='arrays', common_timebase=True)

Is there a way to create a table with ##TX blocks and also ##CC blocks?(in order to simulate a scale conversion)

Thank you!

raresRad1
  • 1
  • 1
  • 1

1 Answers1

0

If anyone needs it, I found the answer and it was simpler than expected.

Create another conversion (i.e conversion2) in the same manner as the first one, then reassign the value of one of the references to it.

conversionBlock = from_dict(conversion)
conversionBlock.referenced_blocks["text_4"] = from_dict(conversion2)
raresRad1
  • 1
  • 1
  • 1