Questions tagged [textscan]

Matlab function for reading formatted data.

textscan is a Matlab function for reading formatted data from text file or string.

For more details, see the Matlab's official doc.

222 questions
0
votes
1 answer

Reading column vector from .txt file in matlab

I am trying to read the following sequence of numbers from a…
0
votes
2 answers

Matlab ischar is not recognizing numbers

I am trying to write a robust read command for my application. I want the read code to be able to handle whether the *.txt has a header (title) line or not. The user will create a trajectory file that is always 7 columns wide and an unknown length.…
AF_Aggie
  • 109
  • 2
  • 13
0
votes
2 answers

Read multiple lines off a csv file

I have a csv file which looks like the following when I open it in notebook... val1,val2,val3,val4,val5,val6,val7,val8,val9,val10,val11,val12,val13,result 63,1,1,145,233,1,2,150,0,2.33,0,6,F 67,1,4,160,286,0,2,108,1,1.5,2,3,3,T …
Marmstrong
  • 1,686
  • 7
  • 30
  • 54
0
votes
0 answers

Open an ASCII file wtih textscan matlab

I am trying to open an ASCII file in MATLAB using textfile. It's a very large file with 13 rows of string headers and a 1399 by 1399 matrix of floating point numbers. Some value are blank but I cannot know which ones. The file has comma separated…
0
votes
1 answer

Matlab:Reading textfile into matrix

I want to read data from a text file in Matlab. The file describes a surface consists of two parts: 1)A header with information on x,y dimensions in pixels and nm etc. 2)Matrix with height values (512x512) When I try to read just the matrix first I…
cos4
  • 95
  • 1
  • 2
  • 9
0
votes
1 answer

Read a string from text file returning strange characters in MATLAB

I'm reading a string like "1.0.2" from text file with these codes : reader = fopen('Address\My_Text.txt'); Out= textscan(reader,'%str'); Out1=Out{1} ; Out2=Out1{1}; fclose(reader); This code (Out2) returns a string like this: 1.0.2 . This is a…
Eghbal
  • 3,892
  • 13
  • 51
  • 112
0
votes
2 answers

Importing data block with Matlab

I have a set of data in the following format, and I would like to import each block in order to analyze them with Matlab. Emax=0.5/real ---------------------------------------------------------------------- …
G4uss
  • 3
  • 1
0
votes
1 answer

MATLAB: textscan to parse irregular text, trouble debugging format specifier

I've been browsing stack overflow and the mathworks website trying to come up with a solution for reading an irregularly formatted text file into MATLAB using textscan but have yet to figure out a good solution. The format of the text file looks as…
seldamat
  • 59
  • 5
0
votes
1 answer

Matlab: Import multiple numeric csv .txt files into single cell array

I have multiple (say N of them) .txt files consisting of numeric csv data in matrix form. I would like to import each of these data files into one (1 x N) cell array, whilst preserving the original matrix form. If the original data is small, say…
0
votes
1 answer

Matlab textscan with mixed data types

I have a '.ismr' file which I am able to open with fopen. The file has several columns (but I am interested in first 9 of them) and several rows. On of the rows is: 1655, 60.00, 12, 00A00000, 184.25, 21.92, 42.02, 0.099385, 0.079280, After…
Mushi
  • 367
  • 2
  • 4
  • 14
0
votes
1 answer

Matlab, textscan: precise row picking

Matlab and textscan issue, sadly. In my case I am able to import my data of interest, using: f = fopen(file,'r'); % Open text file data=textscan(f, '%f %f %f %f %f %f %f %f', 'Delimiter',',', 'HeaderLines',14); fclose(f); But In the 12th and 13…
Aretu
  • 5
  • 3
0
votes
0 answers

Matlab: urlread and textscan to retrieve html data

This is probably a basic question, but I'm new to MATLAB and have been struggling with it for a while. I'm trying to import data from a website using urlread. I can import the data into a cell but it is in html form and I lose all the table…
user3498384
  • 55
  • 1
  • 7
0
votes
1 answer

Problems Using Textscan to Read Multiple Lines

I'm a bit new to data import using Matlab. Basically, I have an Ascii file. It has 13 Header Lines, along with 765 columns and ~3500 rows of data. I am attempting to import the data into a 3500 x 765 matrix in Matlab. I've tried the…
Michael Hu
  • 83
  • 5
0
votes
1 answer

Using textscan to read certain rows

I am trying to read data from a text file using textscan from Matlab. Currently, the code is provided below reads rows 1 to 4. I need it to read rows from 5 to 8, then rows from 9 to 13 and so on. How would I achieve…