Thread: Reading a file and storing it as a 2d Array.

  1. #16
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Quote Originally Posted by zimbomac View Post
    thats what i was thinking subsonics, but again i would need to surly read the file to find the number of rows?
    It's elegant for sizing your array, but not essential. PC's nowadays have enough memory that if you make a 2D float or double array of size 1,000 rows, (when the rows of data are always less than 600 rows of data), it's no big deal.

    You can afford to be Mr. Christmas with your memory, sometimes.

  2. #17
    Registered User
    Join Date
    Jan 2009
    Posts
    1,485
    Quote Originally Posted by Adak View Post
    It's elegant for sizing your array, but not essential. PC's nowadays have enough memory that if you make a 2D float or double array of size 1,000 rows, (when the rows of data are always less than 600 rows of data), it's no big deal.
    It really depends on how strict the requirement are, no?

    Quote Originally Posted by zimbomac View Post
    I have been given the assignment to create a program to find the the least squares method of fitting a straight line function to one of two data sets given to me in a txt format. the file has an unknown number of data points.
    But I would definitely check if there is an upper limit mentioned somewhere, because then I agree, your method is really the way to go imo.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 7
    Last Post: 04-25-2012, 04:30 AM
  2. Reading from File and Storing into Array
    By Magic staple in forum C Programming
    Replies: 13
    Last Post: 12-05-2011, 12:00 AM
  3. Replies: 12
    Last Post: 09-23-2010, 11:49 AM
  4. Help - Reading a file and storing it as a 2d Array.
    By MetallicaX in forum C Programming
    Replies: 2
    Last Post: 03-08-2009, 07:33 PM
  5. Reading strings from a file and storing into an array
    By Rizage in forum C++ Programming
    Replies: 1
    Last Post: 10-24-2002, 03:04 AM