0

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?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Odrisso
  • 1
  • 1

1 Answers1

0

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
jja
  • 2,058
  • 14
  • 27
  • It looks like you are the only person who knows `praat`. Can you [suggest](https://stackoverflow.com/questions/61019222/how-to-apply-praat-script-to-an-audio-file) me how to run `praat` scripts? – Joys Apr 03 '20 at 19:46
  • @Joys There ya go – jja Apr 03 '20 at 21:10