Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Reading multiple tables from file with textscan

Subject: Reading multiple tables from file with textscan

From: Eyal Fleminger

Date: 30 May, 2011 10:06:04

Message: 1 of 3

Hello

I have a text file format where each file contains several tables. Each table consists of a header section and the table itself (the number of rows and columns is not constant, although I know the latter in each case); each table has a string ('EOT') to mark its end (the termination string is constant and I know it in advance).

What I want to do for each table is to advance to the end of the header (which I can do with fgetl, for instance), use textscan to read the table until the 'EOT' string, and then continue on to the next header. The problem is that I don't know how to get textscan to stop reading at a certain point; it tries to read the entire file.

Does anyone have any idea how to do this?

Thx

Subject: Reading multiple tables from file with textscan

From: Rune Allnor

Date: 30 May, 2011 10:22:52

Message: 2 of 3

On May 30, 12:06 pm, "Eyal Fleminger" <eflemi...@gmail.com> wrote:
> Hello
>
> I have a text file format where each file contains several tables. Each table consists of a header section and the table itself (the number of rows and columns is not constant, although I know the latter in each case); each table has a string ('EOT') to mark its end (the termination string is constant and I know it in advance).
>
> What I want to do for each table is to advance to the end of the header (which I can do with fgetl, for instance), use textscan to read the table until the 'EOT' string, and then continue on to the next header. The problem is that I don't know how to get textscan to stop reading at a certain point; it tries to read the entire file.
>
> Does anyone have any idea how to do this?
>
> Thx

Write a parser that reads the format directly.

Rune

Subject: Reading multiple tables from file with textscan

From: Eyal Fleminger

Date: 30 May, 2011 18:42:02

Message: 3 of 3

Rune Allnor <allnor@tele.ntnu.no> wrote in message <fb27bd6d-e30d-470a-ad74-cc289e289547@gc3g2000vbb.googlegroups.com>...
> Write a parser that reads the format directly.
>
> Rune

I'm actually trying to avoid doing that...

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us