Hello all,
I'm having difficulty with reading data from external files.

I have to read two inputs from two Excel files. One is a matrix A[3][20] which is stored as a 3x5 matrix (in Excel format) in the file AData.xls and the other one is a vector dV[35] which is stored as a column vector again in the file UnDiff.xls
My first question is how to write these commands? Should it go in a "for" loop? Or should I start from the beginning until eof is true?

Also, the second question is since these parameters are supposed to be constant throughout the runtime, do I need to define them as parameters? If yes, how can I do that?

I appreciate any help,
Thanks

Please provide sample format of AData.xls. Is the general .xls format a comma separated file with each new line in the spead sheet represented by a new line in the file? Is each line of the matrixes/vector located on a new line of the file?

If the 3x20 array is composed of four contiguous 3x5 arrays, then it's probably a relatively simple matter of learning the exact file format and extracting the information.

For reasing the data i would use a while loops thats condition is the file reading operations its self such as

while(getline(afile, myString)){
//code here
}

Chris

As a matter of fact, I now changed the structure of the file to represent the exact structure of the matrix A. In other words, the Excel file now has 3 rows and 20 columns. Since I'm using the tabular format in Excel I don't have any commas between different entries in one line (i.e. one row of the matrix). Is that going to work? Or should I have a comma separated format?

Please provide sample format of AData.xls. Is the general .xls format a comma separated file with each new line in the spead sheet represented by a new line in the file? Is each line of the matrixes/vector located on a new line of the file?

If the 3x20 array is composed of four contiguous 3x5 arrays, then it's probably a relatively simple matter of learning the exact file format and extracting the information.

The organization of data viewed on the screen using Excel, and other programs, frequently has little correlation with how it's stored in the file. Try to open the .xls file in a text editor to see if you get a readable format. There may be an option in Excel to determine what type of file format can be used to store the data on the screen in a file, but often there isn't, and you somehow have to figure out the file format before you can effectively deal with the contents outside the context of Excel.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.