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

How to use textscan and then save that text file file as a mat file?

I have unsigned feature vectors stored in a text file named data1.txt. How can I use textscan in a code below to extract these FV as dimensions are too much (50 rows and 262144 columns) and store them in a mat file? clc; clear all; close…
user2102092
  • 31
  • 1
  • 1
  • 4
0
votes
1 answer

String to number. Same delimiter for variables and decimals. Matlab

I have a string with six values: datastring = A, 12229, 1480413555450, 139,1473389, 012,3362331, -001,7571955 where the first one is a letter and the rest are float number, I would like to get the numeric values using: data=textscan(datastring,'%s…
0
votes
1 answer

How read this structure using MATLAB textscan function?

I have this structure in a text file named my_file.txt. # Codelength = 3.74556 bits. 1:1:1:1 0.000218593 "v12978" 1:1:1:2 0.000153576 "v1666" 1:1:1:3 0.000149092 "v45" 1:1:1:4 0.000100329 "v4618" 1:1:1:5 5.1005e-005 "v5593" 1:1:1:6 3.53112e-005…
Eghbal
  • 3,892
  • 13
  • 51
  • 112
0
votes
1 answer

Read line delimited by comma and tab

I would like to read files containing numbers in each line. Here is the example of the format- 0,0,0 1 0 0 0 0.02,0.1,0.98 8.77 0.985292 0.112348 0.112348 0.04,0.2,1.96 8.77 0.985292 0.112348 0.224696 As above shown,…
dinex
  • 367
  • 5
  • 15
0
votes
0 answers

Matlab: using Textscan to get info from .txt files downloaded from ftp site

I'm writing a function that given the path of a folder, will download all FTP files from this URL (open in Chrome) and will also return a structure or cell array with the information from those files. So far, I had no trouble with most of files, but…
Aquiles Páez
  • 503
  • 6
  • 18
0
votes
0 answers

How do I import a file with arbitrary format into matlab?

I'm trying to import a large number of datasheets in Matlab, but the sheets are in an odd format that is unable to be read by the common functions (e.g. load, importdata). I've attempted to read this in with textscan, but have not been very…
0
votes
2 answers

MATLAB: Reading space separated float values from tex file

I am reading a text file using the textscan function of MATLAB. Problem here is that nothing is being read in value as the floating points are separated with three spaces and I am quite new in MATLAB programming to use some efficient syntax. My…
Itban Saeed
  • 1,660
  • 5
  • 25
  • 38
0
votes
2 answers

Matlab: Reading from .txt file

I've got a .txt file with always two values per line separated by tabs: 0 0 23 69 45 108 81 158 110 253 125 357 141 492 165 606 179 753 189 983 . . 0 0 4 31 33 38 45 89 60 115 75 166 93 201 107 216 116 291 133 366 148 480 170 631 196…
Mike-C
  • 43
  • 7
0
votes
2 answers

Scan text file into Matlab

I have a text file which I want to import into matlab. Here are the first 2 rows of the text file (tempfile.txt): 1,"4/26/2016","6:40:00 PM","111","0","13.45","NaN","ACTIVE","NaN", 2,"4/26/2016","6:40:30…
TYL
  • 1,577
  • 20
  • 33
0
votes
1 answer

Wrong float precision using textscan in Matlab

I have a devised a function in matlab that allows me (or so I thought) to extract data from a textfile that looks like this (at least the beginning) G1 50 G2 50 M-0.35 0 M-0.05 0.013 M3.3 0.1 M9.75 0.236 M17.15 0.425 M25.85 0.666 M35.35 0.958 The…
F.D
  • 3
  • 3
0
votes
2 answers

Reading .txt. data in Matlab

I have a very basic table Alcohol Tobacco 6.47 4.03 6.13 3.76 6.19 3.77 4.89 3.34 5.63 3.47 4.52 2.92 5.89 3.20 4.79 2.71 5.27 3.53 6.08 4.51 4.02 4.56 I have tried reading it in using textscan but get…
Orongo
  • 285
  • 1
  • 6
  • 16
0
votes
2 answers

Missing information after reading text file with textscan (Matlab)

I am trying to read a comma delimited text file but there is information missing on my results. The following is an extract of my text file: number,datetime start,datetime arrive 4027,25/03/2016 11:20,25/03/2016 11:20 4000,25/03/2016…
Sarah
  • 325
  • 6
  • 17
0
votes
1 answer

Ignoring header lines in the middle of the text file using matlab

I have a text file with multiple sections of observations. Each time, when the new observation starts, the file have some information for the data following (like header of a file). When I used textscan, I could only able to read the first section…
Mushi
  • 367
  • 2
  • 4
  • 14
0
votes
1 answer

why textscan does not read all rows matlab

I have a text file which have 5 columns. Here is sample data: book 1 3 5 7 paper 3 9 0 2 pen 3 1 2 0 pencil 9 0 3 9 The first column contains character and the other columns are just number. The file contains several rows. I am…
mee mee
  • 547
  • 3
  • 8
  • 20
0
votes
0 answers

Matlab Textscan Cell in Cell?

I have a little problem. I know how to avoid it, but I'm not sure is the best. String = textscan('Hello_World','%s','delimiter','_') This returns a {1x1 cell} with a {2x1 cell} in it: String = {2x1 cell} What I want requires an additional…
Mar Vino
  • 17
  • 4