Improve company productivity with a Business Account.Sign Up


length of a multi dim array

Posted on 2009-05-11
Medium Priority
Last Modified: 2012-05-06
 Is use   TImageFilterREAL =  array of array of Real; in many procedure I shift theses data through all my code.  I do not want to pass the dim. of this array also between the procedure calls

How to get the length of an multidimensional array, the length command just uses the
length of the first array
type ;
         TImageFilterREAL =  array of array of Real;
procedure LoadArrayfromCSVFile(aFilename: String; aImageFilterREAL : TImageFilterREAL);
      setlength( aImageFilterREAL, CSVWordlist.Count, CSVFile.Count);
here comes the problem 
            LoadArrayfromCSVFile(myOpenDialog.FileName,  aImageFilterREAL );
                            //  another array     //  use second dim of this array 
            setlength(MyScaleData,          length(  aImageFilterREAL[0]));

Open in new window

Question by:BdLm
  • 3
  • 2
  • 2
LVL 26

Accepted Solution

Russell Libby earned 1800 total points
ID: 24356330
Because both dimension are open, you need to check one of the elements for its length.


var  x:             TImageFilterREAL;
     dim1, dim2:    Integer;

  SetLength(x, 10, 20);


// dim1 = 10
// dim2 = 20


LVL 39

Assisted Solution

by:Geert G
Geert G earned 200 total points
ID: 24358301
why not use a Variant ?
LVL 26

Expert Comment

by:Russell Libby
ID: 24358503
What would be the reason for a variant if the author is only storing real values? Its 10 additional bytes per entry.
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.


Author Closing Comment

ID: 31580209
I tried myseld also with length(X[0]) and failed, now this is working, maybe I had a typo ...
LVL 39

Expert Comment

by:Geert G
ID: 24362119
it's more flexible for multidim arrays (and yes, ... slower too)
i just suggested a option

Author Comment

ID: 24362153

Ps:  for adding elements at the beginng at at the end ->

may be It would better to use a TList  :-( after coding many lines .....
LVL 39

Expert Comment

by:Geert G
ID: 24362168
i guess that would be with l at the end

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Watch the video of Kernel Migrator for SharePoint, which demonstrate the process easily of migration from SharePoint to SharePoint, OneDrive for Business & Google Drive servers, Public Folder to SharePoint, File Server to SharePoint. The tool has va…
Watch the video to know the simple way to remove or recover or reset lost or forgotten passwords of Outlook PST file. With Kernel Outlook Password Recovery tool such operation is very easy to perform. It is a freeware with limitation to use with 500…

595 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question