MATLAB: Reading in a file with just numbers into a known matrix size

plottext file

I am ENTIRELY new to Matlab and am having issues trying to read in a file of just numbers into a Matrix. My file contains floating point values and -nan which are space delimited. So it kind of looks like the following:
-109.982 -9876.90 -888.091 -nan -nan -nan 8792.112 123.345 998.332
But 100 lines longer. I know what the size of the resulting matrix should be (since I generated it) approx. 10×10. This differs based on my file.
Now I just need to read in that blob of data and plot it out as [x, y]
ANY help would be appreciated.

Best Answer

  • For your matrix as you describe it, just use the load (link) function:
    YourMatrix = load('YourFile.txt');