Got Questions? Get Answers.
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:
textscan

Subject: textscan

From: Jonathan

Date: 1 Jun, 2011 20:00:21

Message: 1 of 2

Hi,

I have the following dataset in the form...

 WS= 11.33 WD=350.00 DR= 1.00 WH= 0.23 WP= 1.72 WD= 9.00 DL= 0.60

I don't need the strings only the values. I have developed some simple code using textscan, with limited success. My initial code is:

fid = fopen(fname,'rt');
data1 = textscan(fid,'%4c%n%*[^\n]','delimiter','');
fclose(fid);

Based on this, I lump the first 4 characters together, and then the first column of numbers are read in. Ok, this part works and I can repeat this approach for all the other columns of interest. However, this is not an efficient way of doing it. I simply don't get how to generate a single textscan line of code to filter the entire row of data. Any suggestions would be much appreciated.

Thanks
Jon

Subject: textscan

From: Jonathan

Date: 1 Jun, 2011 20:10:18

Message: 2 of 2

"Jonathan" <jkakiwi@yahoo.co.uk> wrote in message <is65ol$o4k$1@newscl01ah.mathworks.com>...
> Hi,
>
> I have the following dataset in the form...
>
> WS= 11.33 WD=350.00 DR= 1.00 WH= 0.23 WP= 1.72 WD= 9.00 DL= 0.60
>
> I don't need the strings only the values. I have developed some simple code using textscan, with limited success. My initial code is:
>
> fid = fopen(fname,'rt');
> data1 = textscan(fid,'%4c%n%*[^\n]','delimiter','');
> fclose(fid);
>
> Based on this, I lump the first 4 characters together, and then the first column of numbers are read in. Ok, this part works and I can repeat this approach for all the other columns of interest. However, this is not an efficient way of doing it. I simply don't get how to generate a single textscan line of code to filter the entire row of data. Any suggestions would be much appreciated.
>
> Thanks
> Jon

Figured it out!

Tags for 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