In Praat, I need to write a script where I can create a table with multiple column. And then also insert data into those column.
Please let me know how to do it?
In Praat, I need to write a script where I can create a table with multiple column. And then also insert data into those column.
Please let me know how to do it?
You can create Table
objects with column names with the appropriately named Create Table with column names...
command. You give it the name of the object, the number of rows, and a string with the name of the columns, separated by spaces.
To insert values into the table you need to have it selected, and then use the Set numeric value...
or the Set string value...
, depending on the type of data you want to insert.
columns$ = "index text number"
rows = 10
table = Create Table with column names: "table", rows, columns$
for i to rows
# The table is already selected, but it's always a good idea
# to confirm the selection at the beginning of a for loop
selectObject: table
Set numeric value: i, "index", i
Set numeric value: i, "number", randomGauss(0, 0.1)
Set string value: i, "text", "this is row " + string$(i)
endfor