**show array of array of array of array...**I'm trying to print an array of (datas and array of (datas and array of
(datas and array.....
Here is the code:
...

**Re: show array of array of array of array...**sorry..the code:
function printtree($array, $level){
while(list($k,$v) = each($array))
if(is_array($k)){
print("$k -><br>");
printtree($k,$level++);
}
else
{
for($i=0;$i<$level;$i++)
print(" ");
print("$k : $v<br>");
}
}
but it does only print the first level and get out !!!
I can't figure what's wrong....
Please help !!!!
BoB
Bob Bedford wrote:
> sorry..the code:
>
> function printtree($array, $level){
> while(list($k,$v) = each($array))
> if(is_array($k)){
> print(&quo...

**const and array of array (of array ...)**Imagine I have an array of arrays of ints and want to sum all the
ints.
#include <stdio.h>
int sumints(int arr[3][3])
{
int c, r, s=0;
for (r=0; r<3; r++)
{
for (c=0; c<3; c++) {
s += arr[r][c];
}
}
return s;
}
int main(void)
{
int my_array[3][3] = {{0, 1, 2}, {3, 4, 5}, {6, 7, 8}};
printf("sum of ints is %d\n", sumints(my_array));
return 0;
}
I tried to define the su...

**Arrays Of Arrays: Is it an Array or Scalar?**I have a function that I'm using to perform operations on strings in an
array. There are times where I'd like to have this function work on arrays
of arrays. Is there a simple way to tell if the value of an element in an
array is a scalar, or is, instead, a reference to another array?
I know I can use a regex to see if the string matches the pattern for an
array reference, but is there a more "elegant" and easier way to do it?
(And, while I'm at it, is there a way to check for a hash as well? I'd
think they'd both be done the same way.)
Thanks!
Hal
In <...

**Length of Array of Array of Array**How to find the length of an "Array of Array of Array"
I get syntax error when i say $#fx[0][0][0]
X-Ftn-To: Tom
sudhirx@gmail.com (Tom) wrote:
>How to find the length of an "Array of Array of Array"
>
>I get syntax error when i say $#fx[0][0][0]
This should give you the latest index from third level array,
$#{ $fx[0][0] }
--
Matija
Tom <sudhirx@gmail.com> wrote:
> How to find the length of an "Array of Array of Array"
>
> I get syntax error when i say $#fx[0][0][0]
Well first off, the $#array syntax does NOT give you the leng...

**An array of arrays**My problem is I need to create a loop which will store 40 images in separate arrays.
Here is my code:
for n=[1:1:40]
if n<10
A1='subFolder\photo000';
elseif n>9
A1='subFolder\photo00';
end
A2=num2str(n);
A3='.jpg';
fileDir=strcat(A1,A2,A3);
rgb_img = imread(fileDir);
end
The problem is I want a range of arrays like:
rgb_img1
rgb_img2
rgb_img3
....
rgb_img40
Do I need to use a 3 dimensional array for this. I am genuinely confused. :)
Cheers,
Chris
"Chris " <chris.taeni@gmail.com> wrote in message
news:i5ms2l$652$1@fre...

**convert array to array-of-arrays?**Rubies:
Given [1, 2, 3, 4], what's the most Rubiesque way to get [[1, 2], [3, 4]]?
I had figured a variation on Array#transpose would be available, but I can't
find one!
--
Phlip
On Feb 4, 10:45 am, Phlip <phlip2...@gmail.com> wrote:
> Rubies:
>
> Given [1, 2, 3, 4], what's the most Rubiesque way to get [[1, 2], [3, 4]]?
>
> I had figured a variation on Array#transpose would be available, but I can't
> find one!
>
> --
> Phlip
have a look at enum.partition (http://ruby-doc.org/core/classes/
Enumerable.html#M003161)
cheers
Chris Hu...

**How to separate array from array of arrays**Hello
I don't know if what I wrote in subject makes any sense. I have an array in which there are two entries, which are again arrays (one is numbers and one is text). Like I have entry called NEWDATA1 in workspace and in NEWDATA1 , there are entries called 'data' and 'textdata'. I want to separate 'data' (which is a column of numbers) from NEWDATA1. I actually imported a file (concfromcmg1.txt) which looks like
Global Mole Fraction(SOL) 2000-01-01 1,1,1’ *SRF-FORMAT 0
Global Mole Fraction(SOL) 2000-01-03 1,1,1’ *SRF-FORMAT 0.705627
...

**Multidimensional arrays and arrays of arrays**Hello
How can I distinguish if an array is multidimensional of if it just
contains an array? Or put it another way how can I tell at runtime
whether a/b in the example below is an array containing an array, or
if it is a multidimensional array.
If I know beforehand exactly which type it is, I can use instanceof
(see example), but I don't (especially the number of dimensions, I
don't know).
Else I can call getClass().getName() on the object and see if it
starts with "[[" (pretty ugly IMHO).
Is there another, cleaner method to do this?
public static void main(String[] args) {
...

**array of array**Hi,
I need to create something like a matrix, say 32 bits on each row and
up to 4 rows.
That's why on my Spartan3 I have to receive 32 bits word from a serial
port and I have to store them (I know I can just place a 32x4 bits long
vector and store the data in the same row, but I'd like to learn more
about array of array).
I wrote:
type row is array (cmd_buffer_word downto 0) of std_logic;
type cmd_buffer is array (cmd_buffer_depth downto 0) of row;
now, how could I transfer the whole 32 bits data inside a vector called
cmd_tmp_buffer into the second row of my cmd_buffer?
This follow...

**array of array**I've to save in an array of array some values.
Problem: I don't know the size of the array before filling it.
I'd like something like
$bigarray = array():
then runnig the code I must create dinamically (I don't know how many) few
arrays in the bigarray;
$bigarray["X"] = array():
$bigarray["Y"] = array():
then fill those arrays with few unknow number of values.
array_push($bigarray["X"],$value1);
array_push($bigarray["X"],$value2);
array_push($bigarray["Y"],$value5);
....
but array_push doesn't manage it.
How to do so...

**array in array??**awk '
BEGIN{FS=OFS=":"}
{split($4,a,",")
for(i in a)u[a[i]]
for(i in u){x=x","i;delete u[i]}
print $1,$2,$3,substr(x,2);x=""
}' /etc/group
for(i in a)u[a[i]]----------------------------------------------I
could not understand this line
This means we can an array in an array??
nag wrote:
>
> for(i in a)u[a[i]]
>
> I could not understand this line
>
> This means we can an array in an array??
Yes. In the above example, the values of array a are used as subscripts
of array u. See also:
http://www.gnu.org/software/gawk/...

**array of...array....**I've this structure in a XML file:
Type
Model
Detail
Datas
Datas
Datas
Datas
/Detail
Detail
Datas
Datas
Datas
/Detail
/Model
/Type
I've parsed all the stuff, by putting everything in an array.
Now, I've a problem as I must use datas in "Detail" tag every time they are
processed, but I must first process datas in Model, so I have to wait until
Model tag is closed.
For now I put everything in an array called $datas (where I store the couple
key/valu...

**array or not array?**Hi all,
i'm a real noob in databasedesign, so i have some questions about it. In
case i want to make a booklist with two tables and the following fields:
owner_table has the fields ID, name, books
book_table has the fields ID, author, title, isbn
normally i would say, this is easy, just filling both tables with data
and linking them together maybe like owner_table.books as a foreign key
linked to book_table.isbn or book_table.ID.
In this way i will have many datasets in owner_table with the same entry
in 'name', depending on how much books this man (or women) has.
...

**When is an array not an array?**Hi, folks.
I've encountered what seems to me to be something of an oddity while playing
around with XML parsing in PHP, and I wondered if any of you might be able
to clear up my confusion...
Here's a little code:
$xmlDoc = new DOMDocument();
$xmlDoc->load('widget_data.xml');
$widgets = $xmlDoc->getElementsByTagName('widget');
My understanding was that '$widgets' is an array of elements, and the
following 'foreach' iterates through that array (this works):
foreach ($widgets as $widget)
{
....
}
However, I get an error if I try to access ...

**Array in Array**Hi guys,
I have a question dealing with arrays. Here it go:
Suppose A is a 3 by 1 array, I want to assign A (1,1) a 5 by 1 array B, can I do this? How?
Thanks in advance!
"George " <guanjihou@gmail.com> wrote in message <hutpgd$km$1@fred.mathworks.com>...
> Hi guys,
>
> I have a question dealing with arrays. Here it go:
>
> Suppose A is a 3 by 1 array, I want to assign A (1,1) a 5 by 1 array B, can I do this? How?
>
> Thanks in advance!
Hi George, make A a cell array
A = cell(3,1);
B = randn(5,1);
A{1} = B;
Wayne
% Us...

**Array of arrays**Hello,
How do I define an array of arrays ?
Suppose T is an array of 3 elements.
And I want T[0] = intarr(2,5,4), T[1] = intarr(6,5,4) and T[2] =
intarr(7,8,4).
How do I declare T ?
Francois.
Fritz writes:
> How do I define an array of arrays ?
>
> Suppose T is an array of 3 elements.
> And I want T[0] = intarr(2,5,4), T[1] = intarr(6,5,4) and T[2] =
> intarr(7,8,4).
>
> How do I declare T ?
As a pointer array. :-)
t = PtrArr(3)
t[0] = Ptr_New(intarr(2,5,4))
t[1] = Ptr_New(intarr(6,5,4))
t[3] = Ptr_New(intarr(7,8,4))
(*t[1])[0,*,2] = Indgen(...

**Array of Array**Hello,
I am wondering if a three-dimensional arrays:
array3d_1, array3d_2, array3d_3.
Is it wise If pass this to a function/subroutine using array
constructor to create four-dimensional array on the fly, such as:
call mysubroutine ( (/array3d_1, array3d_2, array3d_3/) )
? Will that be expensive, or is there better way to do it ? I am also
not certain if this on-the-fly array construction will be the first or
the last dimension.
Thanks for any help.
RDB
reubendb <reubendb@gmail.com> wrote:
> I am wondering if a three-dimensional arrays:
> array3d_1, array3d_2, array3d_3.
> Is...

**array of arrays**i have a database with some 10 records each containing 2 columns,
sno,name,city.
I want to push this into an array of arrays.
i see that Ruy doesnt support multi-dimensional arrays.
Any ideas of how to do it?
--
Posted via http://www.ruby-forum.com/.
Hi --
On Sat, 21 Jul 2007, Divya Badrinath wrote:
> i have a database with some 10 records each containing 2 columns,
> sno,name,city.
>
> I want to push this into an array of arrays.
> i see that Ruy doesnt support multi-dimensional arrays.
> Any ideas of how to do it?
Just use arrays as array elements:
[ [1,2,3], [4,5,...

**array of array?**Hi, there,
I wonder, if that is possible to have a array of arrays, for example
A(1)=a1(1:N,1:M);
A(2)=a2(1:N,1:M);
A(3)=a3(1:N,1:M);
�
If no such thing, is there any simple method to do the same things as
dimension
A(i,j,k) in Fortran?
Could any one please input anything?
Thanks
hnliuhy wrote:
>
>
> Hi, there,
> I wonder, if that is possible to have a array of arrays, for
> example
> A(1)=a1(1:N,1:M);
> A(2)=a2(1:N,1:M);
> A(3)=a3(1:N,1:M);
> �
>
> If no such thing, is there any simple method to do the same things
> as
> dimension
> A(i,j,k) in Fo...

**Array of array**Hi friends,
Please kindly assist me with an answer to this question:
Is it possible to create a Matlab array whose elements are in turn 3 element arrays?
I mean, how can I create an array as A = {(1,2,2), (3,2,1), (5,3,4), etc}. If possible, how do I access the elements of this array. If not, could this be possible in Fortran?
Thanks.
On 12/25/2012 8:14 PM, CHINEDU wrote:
> Hi friends,
> Please kindly assist me with an answer to this question:
>
> Is it possible to create a Matlab array whose elements are in turn 3 element arrays?
> I mean, how can I create an arr...

**arrays in arrays?**In PERL I can put arrays in arrays.
my @array1 = ('val1', 'val2', 'val3');
my @array2 = ( \@array1 );
In TCL I'm trying
set arr1(key1) val1
set arr1(key2) val2
set arr1(key3) val3
set arr2(key4) $arr1
Tclsh rightfully complains that $arr1 is a scalar and not
an array. How do I set an array as the value in another array?
Mike
Mike schrieb:
> In PERL I can put arrays in arrays.
>
> my @array1 = ('val1', 'val2', 'val3');
> my @array2 = ( \@array1 );
>
> In TCL I'm trying
>
> set arr1(key1) val1
> set arr1(...

**array of arrays**Hi friends,
I am trying to define a array of arrays.
I have defined:
integer,dimension(2,2):: &
x=reshape(source= (/0,1,1,0/), shape=(/2,2/)), &
y=reshape(source= (/1,0,0,1/), shape=(/2,2/)), &
z=reshape(source= (/1,1,1,1/), shape=(/2,2/))
I want to define an array, say, s(3), of which, (x/y/z) are components, i.e.
s(1)=x
s(2)=y
and s(3)=z.
how can I achieve that?
Rudra Banerjee <bnrj.rudra@gmail.com> writes:
>Hi friends,
>I am trying to define a array of arrays.
>I have defined:
> integer,dimension(2,2):: &
> ...

**arrays of arrays**Does anyone know if (and how) to create an array/vector of vectors, not
necessarily of the same dimension, e.g. if a=[1 2 3] and b=[9,10], if
it is possible to form an array/vector c with c(1)=a, c(2)=b?
Ray wrote:
> Does anyone know if (and how) to create an array/vector of vectors, not
> necessarily of the same dimension, e.g. if a=[1 2 3] and b=[9,10], if
> it is possible to form an array/vector c with c(1)=a, c(2)=b?
You can put any scilab object in a list :
c = list(a,b); // or c=list([1 2 3],[9,10]);
then c(1) is the vector [1 2 3] and c(2) the vector...