localobj array

Anything that doesn't fit elsewhere.

localobj array

Postby pfortier » Fri May 19, 2017 4:01 pm

How can I create a local object array?
I thought of entering "localobj ref[4]" in a procedure but that didn't work.
Outside a procedure, I can successfully create an object array using "objref ref[4]".

Thanks,
Pierre
pfortier
 
Posts: 41
Joined: Thu Apr 20, 2006 8:02 am
Location: University of Ottawa

Re: localobj array

Postby pfortier » Fri May 19, 2017 5:57 pm

Solved by making "localobj ref" and connecting to a List:
ref = new List()
for i=0,3 ref.append(new Vector())
pfortier
 
Posts: 41
Joined: Thu Apr 20, 2006 8:02 am
Location: University of Ottawa

Re: localobj array

Postby ted » Sun May 21, 2017 11:47 am

Good solution. Another possibility, assuming that all vectors are of the same size and you know how many you need to deal with, is to use the Matrix class's setcol() or setrow() method. Which one you choose depends on what you intend to do with all those numbers.
ted
Site Admin
 
Posts: 4987
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine


Return to Other questions

Who is online

Users browsing this forum: No registered users and 1 guest