help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: size of NDArrays


From: Søren Hauberg
Subject: Re: size of NDArrays
Date: Mon, 11 Aug 2008 20:50:56 +0200

man, 11 08 2008 kl. 14:37 -0400, skrev Thomas L. Scofield:
> I can use
> 
>    m.dims ()
> 
> 
> to find out how many coordinates the new array m has.  But how do I
> find out the range of values in a particular coordinate?  That is, if
> the original call within Octave sent a matrix A satisfying
> 
> 
>    size(A) = [256   256   3   10]
> 
> 
> which is what is stored in the argument param, then
> 
> 
>    m.dims ()
> 
> 
> would equal 4.  But what method tells me that the largest valid entry
> in the 4th position is 9?

Actually, m.dims () return a 'dim_vector' which would contain the values
[256   256   3   10]. I can't remember the exact syntax but I believe
you can do something like this:

  dim_vector dims = m.dims ();
  for (int i = 0; i < dims.length (); i++)
    printf ("%d ", dims (i));

which should print "256 256 3 10 ". BTW. the m.ndims () return the
number 4 in this case.

Søren
> 
> 
> Thomas L. Scofield
> --------------------------------------------------------
> Associate Professor
> Department of Mathematics and Statistics
> Calvin College
> --------------------------------------------------------
> 
> 
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://www.cae.wisc.edu/mailman/listinfo/help-octave



reply via email to

[Prev in Thread] Current Thread [Next in Thread]