Page 1 of 1
array of numbers as labels
Posted: 29 Sep 2014 15:20
by electrofux
Hello,
i have an array Oneto16={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}
and i want to use it to set the labels of a padobject (the array changes dynamically).
But setattribute(padobject,'labels',Oneto16} doesnt work. Probably because the elements aren't strings.
How should a go about this to make it work?
Re: array of numbers as labels
Posted: 29 Sep 2014 15:43
by Softcore
{'1','2',.......'16'}
Re: array of numbers as labels
Posted: 29 Sep 2014 15:59
by electrofux
yeah, but the values in the array change and so should the labels- that is the problem. If make the array strings from the start i lose the possibilty to change the numbers by adding/multiplying the values.
I think ineed some sort of conversion to strings but with array to string i didnt get far.
Re: array of numbers as labels
Posted: 29 Sep 2014 16:11
by Softcore
Ohhh I get it now....then use
decl i,k
for (i=0;i<sizeof(Oneto16);i++){
k=''+Oneto16;
}
and then use k instead of Oneto16
Re: array of numbers as labels
Posted: 29 Sep 2014 16:14
by electrofux
Ahhh nice, this works. Thx.
Re: array of numbers as labels
Posted: 29 Sep 2014 16:29
by Softcore
As of Lemur 5 with string concatenation (or what was that called lol) you can make any number-array into a string by simply adding an empty string value before it....
so for example if
k=1;
''+k = '1'