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:
read file with variable column numbers

Subject: read file with variable column numbers

From: Mike

Date: 11 Mar, 2010 05:20:15

Message: 1 of 2

Hi

I have a file like :

s1 3 1. 3. 5. file1 file2 file3
s1 2 3. 5. file1 file2
s1 4 1. 2. 3. 5. file1 file2 file3 file4

the second column decides how many numbers and filenames follows, like
3 there are three numbers and three filenames follows.
I try textscan and importdata, which seems need same columns in each
rows.

How to read this file with variable column numbers?

Mike

Subject: read file with variable column numbers

From: Sadik

Date: 11 Mar, 2010 13:24:07

Message: 2 of 2

Dear Mike,

You can definitely read it using fgetl in a for loop. Please see

help fgetl

for further details.

Best.




Mike <sulfateion@gmail.com> wrote in message <54472496-4e59-440d-a4df-28d621127b3e@k5g2000pra.googlegroups.com>...
> Hi
>
> I have a file like :
>
> s1 3 1. 3. 5. file1 file2 file3
> s1 2 3. 5. file1 file2
> s1 4 1. 2. 3. 5. file1 file2 file3 file4
>
> the second column decides how many numbers and filenames follows, like
> 3 there are three numbers and three filenames follows.
> I try textscan and importdata, which seems need same columns in each
> rows.
>
> How to read this file with variable column numbers?
>
> Mike

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