table2matΒΆ

This function is used to convert matrix data in the Lua table into matrix format inside spin-scenario. It is also helpful if you wish to use write function to save raw data into file.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
 -- Do something to create the raw matrix data e.g. array experiments that each one will return a desired value.
 local usr_table ={}
 for i = 1, 4 do
   for j = 1, 16 do
   usr_table[(i-1)*16+j] = (i-1)*16+j
   end
 end

local m = table2mat(usr_table, 4, 16)

-- Do something else e.g. save it to file or plot the data.
write("matrix.txt", m)