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

Matlab can not split the txt file.

Asked by Saeed on 12 Dec 2012

Hello

I have a text file which matlab can not split to different cell arrays using import data command.

The text file can be seen here< http://dl.dropbox.com/u/41359279/SIG20015.TXT>:

http://dl.dropbox.com/u/41359279/SIG20015.TXT

Since I have many of these files I really do not know how to solve the issue, can anybody help? Thanks

I can bring the data to matlab arrays using the lines below:

  • delimiterIn = ' ';
  • headerlinesIn = 100;
  • A = importdata(path,delimiterIn,headerlinesIn);

where path is the address I use to open the text file, but it takes all the data of a line to one cell array but I can not do any analysis on it.

Best regards

Saeed

0 Comments

Saeed

Products

No products are associated with this question.

2 Answers

Answer by Walter Roberson on 12 Dec 2012

textscan() with HeaderLines as appropriate, and format '%f%f%f%f%s%f%f'

0 Comments

Walter Roberson
Answer by Saeed on 13 Dec 2012

Dear Walter and Pedro

Hi

Thanks for your answers, Yap at last I used textscan command to scan the data. And it works fine. I just did not want to use a loop for taking the results out because I thought it might be time consuming because I will have 10000 of those files. But it works fine. Thanks a lot.

Best regards

Saeed

0 Comments

Saeed

Contact us