Quantcast
Channel: MATLAB Central Newsreader Recent Posts
Viewing all articles
Browse latest Browse all 19628

Re: textscan with numeric empty fields

$
0
0
dpb <none@non.net> wrote in message <ku3alb$rod$1@speranza.aioe.org>...
> On 8/9/2013 12:22 PM, Christian wrote:
> ....
>
> > Format is:
> > AAAAABC*DFFFF1*G*2233*44444*5555*666666*7777*8888*9999*111122333333
> > VSARABZ EPg 0 014 14.65 92 0.0110 VSARABZ IAML 014 19.06 5.90 0.12
> > VKOLHBZ EPg 2 014 15.86 92 -0.07 5
>
> > As the matlab editor gives different field width for character it seems
> > not to be aligned, actually it is, the best would be to copy the above
> > into a suitable programming editor.
>
> The Matlab editor _is_ a suitable programmers' editor--select a
> non-proportional font.
>
I_can't_select the font
>
> I've no clue what the following is intended to represent...
>
> > AAAAABC*DFFFF1*G*2233*44444*5555*666666*7777*8888*9999*111122333333
>
> And, is the above two or three records -- there're two VSARABZ
> values--do they each begin a record or are there two of these together
> on a single record?
>

In my post there are 3 records, some records could have same station name
Don't understand why you ended with 2 records
 
> Also, the last record does _NOT_ appear to actually be fixed width--the
> precision of the second fp value isn't the same nor the width of the
> field. Also then the last integer on that record doesn't align w/ the
> text in the field preceding it if it is only two...and if presume it is
> three, then there are other anomalies.
>
> As requested, provided a FORMAT statement or other way to unambiguously
> define the desired field widths and types of the variables to be returned.
>
> All in all, looking at what you've given so far there seems little
> consistency at all to help...
>

Just forget about the records I gave you and suppose a really simple case:
Let the record be:
'ss45gg67tt'

I want to have, after I textscanned it, the cell C so that:
C(1)='ss' ;C(2)=[45]; C(3)='gg';C(4)=[67] and C(5)='tt'

45 and 67 should be read as floating number.
The fortran equivalent would be (a2,f2,a2,f2,a2)

Now suppose one field is missing and another is slightly different
Let the record be:
'ss gg67 t'

Then I want:
C(1)='ss' ;C(2)=[]; C(3)='gg';C(4)=[67] and C(5)='t'

Viewing all articles
Browse latest Browse all 19628

Trending Articles