Hi,
is there any limitation in handling of arrays in the macro language??? I tried to call a function with 2 parameters, a number and an array, which should return the array again. FileArray=newArray(5); ... FileArray=check_array(i,FileArray); check_array(i,Array){ if (i>Array.length-1){ //error message //create new temporary array temp= newArray(Array.length); temp= Array; //extend array size by 1 Array= newArray(temp.length+1); //copy info from temp array for (x=0; x<temp.length; x++){ Array[x]= temp[x]; } } return Array; } This should extend the array dynamicly. But I get an error message: Array expected at Array.length Falk _____________________ Confidentiality ______________________ This electronic transmission is strictly confidential and intended solely for the addressee. It may contain information which is covered by legal, professional or other privilege. If you are not the intended addressee, you must not disclose, copy or take any action in reliance of this transmission. If you have received this transmission in error, please notify us and delete the received data as soon as possible. This footnote also confirms that this email message has been swept for the presence of computer viruses. _______________________________________________________ |
Hi,
hmm, your sample code is missing a "function" definition in front of check_array, however, this causes another error message. If I add this and run the code it works here (for example when checking the length I could successfully increase it from 5 to 6) I use version ImageJ 1.37g JW "Lucas, Falk /BDF HAM" An: [hidden email] <Falk.Lucas@BEIE Kopie: (Blindkopie: Joachim Wesner/DEWET/LMSCentral/Leica) RSDORF.COM> Thema: handling arrays in macro Gesendet von: ImageJ Interest Group <[hidden email] .GOV> 18.07.2006 18:48 Bitte antworten an ImageJ Interest Group Hi, is there any limitation in handling of arrays in the macro language??? I tried to call a function with 2 parameters, a number and an array, which should return the array again. FileArray=newArray(5); ... FileArray=check_array(i,FileArray); check_array(i,Array){ if (i>Array.length-1){ //error message //create new temporary array temp= newArray(Array.length); temp= Array; //extend array size by 1 Array= newArray(temp.length+1); //copy info from temp array for (x=0; x<temp.length; x++){ Array[x]= temp[x]; } } return Array; } This should extend the array dynamicly. But I get an error message: Array expected at Array.length Falk _____________________ Confidentiality ______________________ This electronic transmission is strictly confidential and intended solely for the addressee. It may contain information which is covered by legal, professional or other privilege. If you are not the intended addressee, you must not disclose, copy or take any action in reliance of this transmission. If you have received this transmission in error, please notify us and delete the received data as soon as possible. This footnote also confirms that this email message has been swept for the presence of computer viruses. _______________________________________________________ ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ |
Free forum by Nabble | Edit this page |