Change a spreadsheet to an array
David Epstein
depstein at att.net
Sun Jan 6 10:22:01 EST 2002
Message: 4
Ludovic THEBAULT wrote:
>I've a big list like this :
>Name name1 name2 name3
>Data1 1 0 10
>Data2 10 1 0
>Data3 0 1 10
>how transform it in one array ?
If the spreadsheet is tab-delimited, and in the variable "myData"
on loadMyArray myData
global myArray
set the itemDelimiter to tab
repeat with n = 2 to the number of lines in myData
repeat with i = 2 to the number of items in line 1 of myData
get item i of line n of myData
put it into myArray[item 1 of line n of myData,item n of line 1 of
myData]
end repeat
end repeat
end loadMyArray
--
from myArray, you can retrieve any data cell by getting
"myArray[rowName,columnName]" -- where rowName is a string like "Data1" and
columnName is a string like "name1"
David Epstein
More information about the use-livecode
mailing list