MATLAB: Using textscan

text filetextscan

Is textscan the correct command to use when importing data from text files into matlab. The command seems to work fine if I only have a vector in the text file, but if I have a matrix, matlab will change the structure of the data and store the matrix as a vector. Which command should I use if I'm importing data from text files within a loop where some of the text files include vectors and others include matrices?

Best Answer

You have to specify the right 'format', read example 8 to get an idea: http://www.mathworks.co.uk/help/techdoc/ref/textscan.html