Which is the equivalent function in matlab for bytearray() in python?

Viewed 61

I'm having troubles trying to convert a python code to matlab. I have this code, it takes values from the ui and makes a stpack from struct library which packs the values in the way indicated "<fififfIi". The code is shown below.

config_data = bytearray(stpack("<fififfIi", self.sample_freq.get(), int(self.run_time.get()*self.sample_freq.get()), self.bia_freq.get(), self.mode.get(), self.sweep_start.get(), self.sweep_stop.get(), int(np.ceil(self.sweep_points.get())), self.sweep_type.get()))
                  

The result I get, which is correct, is bytearray(b'050000.00 01006.441895 0000.789513\x00')

I tried to reproduce that in matlab and I was told to use the following code:

config_data = uint8([char("<fififfIi"), 1, 10, 50000, 0, 500, 50000, 10, 0]);

The numbers inside the function are similar to the real ones but it is just to test the output of the code. However when I take a look at the output, this is what I get:

>> NanoBlA4Wire
Columns 1 through 7

    60   102   105   102   105   102   102

  Columns 8 through 14

    73   105     1    10   255     0   255

  Columns 15 through 17

   255    10     0

I don't understand what the output is or how can I obtain the same output as python in matlab. Does anybody have any idea on what am I missing?

0 Answers
Related