The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Skipping rows of data being read into program.
Replies: 1   Last Post: Feb 25, 2013 5:55 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View  

Posts: 9,850
Registered: 6/7/07
Re: Skipping rows of data being read into program.
Posted: Feb 25, 2013 5:55 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 2/25/2013 4:02 PM, Lcy wrote:
> I am reading in a large file of data with certain rows included that are
> calibration and cannot be included in the research. Each row that is
> calibration is marked differently than the actual data by a string BBXX
> - real data is NBXX. I could just skip the data by mrking it as a header
> line, but it could show up randomly in the text file later on if the
> machine is rebooted and the text file is constantly being updated.
> mode = data{1}; %what is being read in


> What command should I use to skip the rows correctly? I'm not really
> sure how to go about this.

I don't follow the part about why/how it can show up again--if you
read/skip the cal data it can't magically get into memory on its own.

If the string ID is the first thing on the record, I'd use textscan and
the 'commentstyle' option...

fmt='some_appropriate_format_string for the file';
fid=fopen('yourfile','rt'); % open the file
data=textscan(fid,fmt,'commentstyle','BBXX',...whatever other options



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.