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

how can I read multiple text files in matlab?

if possible please let me know that how I can read different text files in Matlab . considering that there is 33 txt files that every one should process. it is my code which has error. :( textFilename = cell(1,33); id = cell(1,33); …
Roze
  • 23
  • 1
  • 7
0
votes
1 answer

Textscan until end of line

I'm trying to textscan a file and read a single line until the end of it, undependently of the number of elements in that line. My file is a .txt file formatted like this…
Vissenbot
  • 227
  • 2
  • 5
  • 15
0
votes
1 answer

Store words after specific expressions in text file using matlab

I have many text files containing data like this: {'photo': {'people': {'haspeople': 0}, 'dateuploaded': '1264588417', 'originalformat': 'jpg', 'tags': {'tag': [{'machine_tag': 0, 'author': '14988396@N00', 'text': 'bokehlicious', 'raw':…
0
votes
1 answer

Speed increase for textscan use

I did a program that takes a .csv file and stacks the 3rd column of each files in the appropriate 3rd dimension of a 512x512xNumberOfFiles cell array. The code goes like this : [filenames,filepath] = uigetfile('*.csv','Opening the data…
Vissenbot
  • 227
  • 2
  • 5
  • 15
0
votes
2 answers

How to skip lines in a txt file using Matlab?

I am working on a GUI program that involves uploading a txt file. The first 80 lines of the file contains information I do not need, it is a mix of numeric and text data. For example here is a few lines of the data I do not want to…
user3580436
  • 47
  • 5
  • 12
0
votes
1 answer

Not a string after textscan in Matlab

I am reading a string of the form: Text1_Text2_Text3_Text4. I do a textscan with the delimiter "_": myString = textscan('Text1_Text2_Text3_Text4', '%s', 'delimiter','_'); output: 'Text1' 'Text2' 'Text3' 'Text4' This is a char array. To transform it…
Baloo
  • 223
  • 4
  • 17
0
votes
2 answers

textscan delimiter = "abc" does not work

I am trying to read a text file that has textual data and separated by delimiter say 'abc' as consecutive characters separating the string that I want to read. Ex: say text.txt file, as follows: John abc Mike abc Micheal Sandra abc Sarah abc…
Zahran
  • 419
  • 4
  • 10
0
votes
3 answers

textscan Unexpected Empty Cell with valid Format string

I am reading a tab-delimited file. Five representative lines of this file are: Date Time Property Path 1 Path 2 Path 3 Path 4 Path 5 Path 6 Path 7 Path 8 Lev 1 Lev 1 Lev 1 Lev 1 Lev 1 Lev 1 Lev 1 Lev 1 1/1 …
Michael Street
  • 645
  • 1
  • 7
  • 19
0
votes
2 answers

Assign structs with conditional statements

I would like to assign input data to 2 different structs, depending on a condition (Matlab). What is the best way to do this? FILE points.dat % Point ID X Y CODE Station1 2.2 4.5 0 Station2 5.1 6.7 0 Station3 7.3 3.2 …
Ben
  • 41
  • 2
0
votes
1 answer

Assign file data to struct

I am trying to create a struct called "points" with members ID, X coordinate, & Y coordinate. What is the simplest way to scan in the data from a file? I'm using textscan, but it's not doing what I want so far. FILE points.dat StationA 2.2 …
Ben
  • 41
  • 2
0
votes
2 answers

textscan() reading result is a nested cell array?

I have a data file containing 100 lines with the following format 0,device1,3 1,device2,33 2,device3,3 3,device4,34 ... 99,device100,36 Now I wish to read them into a 100x3 cell array in MATLAB. I did the following: allData = textscan(fID,'%s %s…
Sibbs Gambling
  • 19,274
  • 42
  • 103
  • 174
0
votes
2 answers

why textscan only read one line

I am trying to read a csv file use textscan. The fields are seperated with ',' . I used the following code, but it only read in one line of data into the matrix W. I also tried dlmread(), it got the number of fields wrong. The file is contructed…
gstar2002
  • 495
  • 9
  • 20
0
votes
1 answer

How can I search a text file for specific words using matlab?

I need to write a program in matlab that searches for key words in a text file and then reads in what comes after those words, then continue searching.i tried to use fscanf or textscan but i must be missing something I have a text file and the…
michael
  • 57
  • 2
  • 10
0
votes
2 answers

How to read only numerical data into Matlab and ignore any text

I am trying to read data into Matlab consisting of rows of numbers and texts however I only want to read the numerical values and skip the text (whenever it occurs). I have been using textscan but to read the numbers in but when it reaches a column…
user3202209
  • 3
  • 1
  • 2
0
votes
1 answer

Matlab: Import .csv-file via textscan

Im working on a program which shall manipulate .csv files from an Experiment. Therefore i want to use the command textscan, which sounds really suitable for my Problem. But I got problems with the implementation of the code. My code Looks like…
cacá
  • 85
  • 1
  • 5