Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 38

Assisted Solution

by:Geert Gruwez
Geert Gruwez 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.
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.


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 38

Expert Comment

by:Geert Gruwez
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 38

Expert Comment

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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

604 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