loading-data-from-files/quickref.tex
changeset 324 4054b1a6392d
parent 285 7c4855fb8e5f
equal deleted inserted replaced
323:e675f9208b91 324:4054b1a6392d
     1 Creating a linear array:\\
     1 \textbf{Loading data from files}
     2 {\ex \lstinline|    x = linspace(0, 2*pi, 50)|}
       
     3 
     2 
     4 Plotting two variables:\\
     3 \lstinline|loadtxt('filename')| returns the columns of file in one
     5 {\ex \lstinline|    plot(x, sin(x))|}
     4 sequence. 
     6 
     5 
     7 Plotting two lists of equal length x, y:\\
     6 \lstinline|x, y = loadtxt('filename', unpack=True)| to obtain a file
     8 {\ex \lstinline|    plot(x, y)|}
     7 with 2 columns in separate sequences. 
       
     8 
       
     9 \lstinline|loadtxt('filename', delimiter=';')|, if the file has
       
    10 columns separated by ';' instead of spaces/tabs. 
       
    11 
       
    12