bubbles
bubbles

Reputation: 881

Reading integers from file in Matlab

I have a file with a numbers separated by line. I would like to scan an entire file say input.txt, and put the numbers into a vector.

I have a basic idea of how to do it but I do not know how to iterate until the end of the file.

The language is Matlab.

Thank you in advance!

Upvotes: 1

Views: 620

Answers (1)

Ben Voigt
Ben Voigt

Reputation: 283614

Try the textscan or fscanf functions. Both can read an entire matrix at one go.

Upvotes: 1

Related Questions