How do I read text data into an array?

I have text data that has multiple columns i.e. Time Data1 Data2 Data3...

Each column has the same number of rows.

What is the best way to read this data into an array of floats?

I am writing the code in C.

Thanks.

Comments

  • : I have text data that has multiple columns i.e. Time Data1 Data2 Data3...
    :
    : Each column has the same number of rows.
    :
    : What is the best way to read this data into an array of floats?
    :
    : I am writing the code in C.
    :
    : Thanks.
    :
    use fscanf. Something like this code fragment.
    [code]
    float Data1[10], Data2[10],Data3[30];
    fscanf(fp,"%f%f%f",&data1[i],&data2[i],&data3[i]);
    [/code]
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion