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
2 answers

read text delimited file and write to excel in matlab

I have a txt file in this format: Right,28772.163,39356.163,1,Speaker1 sp,39356.163,49499.163,99,Speaker1 sp,129129.21,147210.21,99,Speaker2 Next step is,147210.21,160881.21,1,Speaker2 surgery's,160881.21,181608.21,1,Speaker2 and it goes on (it has…
user552231
  • 1,095
  • 3
  • 21
  • 40
0
votes
1 answer

MATLAB - Read Textfile (lines with different formats) line by line

I have a text file (lets call it an input file) of this type: %My kind of input file % Comment 1 % Comment 2 4 %Parameter F 2.745 5.222 4.888 1.234 %Parameter X 273.15 373.15 1 %Temperature Initial/Final/Step 3.5 %Parameter Y %Matrix A 1.1 1.3 1…
ECrespo
  • 135
  • 1
  • 1
  • 8
0
votes
0 answers

Identify hidden control character and ignore when scanning csv file

I am trying to use textscan in MATLAB to read in mixed format data from a .csv file. I am currently running into a problem that there are a number of nonvisible characters which are getting read in as a string when I am not expecting them. I believe…
David K
  • 1,296
  • 18
  • 39
0
votes
2 answers

How to import a csv file with date in matlab and plot it?

I have a csv file that has two columns, date and float, the date format is weird though (Jan 1 2016 9:55:00 PM), how can I import it to matlab and draw it as a plot? this is what i tried: fid = fopen('all.csv'); if fid>0 data =…
Abdane
  • 137
  • 1
  • 12
0
votes
1 answer

Import numbers between parentheses

I have made a datafile from OpenFoam that extracts velocity at a certain location in time. I would like to extract two of these velocity and take there time average. For example I would like to extract the numbers: 0.0539764,0.0104665,0.00201741 and…
ursmooth
  • 311
  • 1
  • 4
  • 12
0
votes
0 answers

Matlab adds extra lines when using textscan

I am trying to read a large .csv file to .dat using textscan. The file contains 124,861 rows including a header row and 130 columns. The data in the file is mixed: strings, doubles, missing values, etc. The .csv data looks like this: example.csv I…
0
votes
1 answer

how to use textscan in matlab

i'm trying to inesrt the following text file into a matrix in matlab time.txt I tried to use 'textscan' fileID = fopen('Uz10.txt'); Uz10=textscan(fileID,'%d'); fclose(fileID); but alwayes got, Undefined operator '*' for input arguments of type…
0
votes
1 answer

textscan with different format data

I have a data which has two formats which I'm trying to scan using textscan in MATLAB 1,2,3,four,five,6 7,8,9,ten,eleven,12 and so on, followed by another bunch of data with format as below 1,2,three,4 5,6,seven,8 I'm trying to scan this data…
maz
  • 3
  • 6
0
votes
1 answer

Reading formatted text from a file

I'm tring to read the follwing text file with Matlab: 00000008.jpg 1 2 1 00000001.jpg 1 2 1 00000054.jpg 1 2 1 What I want to extract is each column of each line in order to access it. I've tried the following code: fileLabels =…
inavas
  • 161
  • 7
0
votes
1 answer

skip lines in txt file using textscan in matlab

I have a huge .txt file and parts of which I want to parse (using text scan), say I have 10000 line data and a part which starts at line 300, the part also has a header of 10 lines say,how can I skip the first 300 lines(not using header function of…
maz
  • 3
  • 6
0
votes
1 answer

How to skip ( and ) while using textscan?

I'm trying to read numbers in a text file line by line. Each line in the file is like this: (563,478),(630,573),1 I tried the command below but it didn't work: textscan(f1, '%d%d%d%d%d', 'delimiter', ','); How can I skip the ")" and "("? I want…
Hadi GhahremanNezhad
  • 2,377
  • 5
  • 29
  • 58
0
votes
1 answer

Textscan - Catch error and try something else

I'm trying to read in a bunch of text files. There's a date column. The format in some of the files for the date column is DD-MMM-YYYY while in others, it's DD-MM-YYYY. I have the code set up to read the first style. But because of that, if it runs…
SugaKookie
  • 780
  • 2
  • 17
  • 41
0
votes
2 answers

How to read data of a certain length in text file and store in an integer array in matlab

I have a text file that looks like…
user3716193
  • 476
  • 5
  • 21
0
votes
1 answer

How do I read comma separated doubles from text file into MATLAB?

I have a text file called Output.txt that looks like…
user3716193
  • 476
  • 5
  • 21
0
votes
1 answer

Scanning Only A Column With Textscan

I want to take the second column of a real time changing text file by textscan command. I can only take the first column of the text file but I want the second column. Here is my code: fileid = fopen (Path); rxt = textscan (fileid, '%d…