You are accessing this site in a read-only mode. For full access to all member benefits, including message posting, please login or register. Registration is completely free, simple, and takes only a few seconds.
The message you are replying to and its parents are listed in the reverse order with the most recent posts first. This might not be the whole discussion thread. To read all the messages in this thread please click here.
Re: Parsing Data
| Markthomas | 14 Jul 2008 18:16 |
dpb <none@non.net> wrote in message <g5g4lq$1ks$1@aioe.org>...
> > dpb <none@non.net> wrote in message <g5fo6p$au6 > > $1@aioe.org>... [quoted text clipped - 43 lines] > > -- the main reason why i can't do the whole file that way is because there are other data types in the structure of the file. besides the numbers there is times, dates, and long strings that have spaces... i wasn't sure which way to and be most efficient
Markthomas
|
| dpb | 14 Jul 2008 18:05 |
> dpb <none@non.net> wrote in message <g5fo6p$au6 > $1@aioe.org>... [quoted text clipped - 21 lines] > > but couldn't get it to work... any ideas on this command? As written you're asking for two return values but telling it to skip the first and return only one.
You're also asking for a space between the two strings -- whether it will ignore that or not I didn't test.
Lastly, the line above doesn't match the "title=value" format you asked about to begin with. It looks like you may want to use the 'headerlines' option of textread().
Why are you doing it this way instead of reading the whole file, anyway?
If you want the names as well as the values, then
[n,b]=textread('yourfile.dat','%s%d','delimiter','=');
worked for a sample file of data as in your first posting...
doc textread
--
|
| Markthomas | 14 Jul 2008 15:54 |
dpb <none@non.net> wrote in message <g5fo6p$au6 $1@aioe.org>...
> ... > > I am trying to parse some data that looks like: [quoted text clipped - 11 lines] > > -- I was tried to use the strread command but was not getting what i wanted:
readin = upper(fgetl(id)) --- i get TYPE=ALL OTHER COMB. [name value] = strread(readin,'%*s %s','delimeter','=')
but couldn't get it to work... any ideas on this command?
|
| dpb | 14 Jul 2008 14:32 |
...
> I am trying to parse some data that looks like: > bfleft1=0 > bfleft2=378 > . > . ...
See if
b=textread('yourfile.dat','%*s%d','delimiter','=');
suits...
--
|
| Markthomas | 14 Jul 2008 13:14 |
Hello all,
I am trying to parse some data that looks like:
bfleft1=0 bfleft2=378 . . . bfleft298=895 bfleft299=900
and i was wondering what the best way to go about doing it. I have other headers other then bfleft# but figured i could figure it out after i learned how to do it! I was guessing i had to search for the "=" then try to get everything to the left and right. Thanks a bunch
markthomas
|
Quick links: