help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

fields not found in struct because of 'µ' (micro) symbol in field name


From: kloof
Subject: fields not found in struct because of 'µ' (micro) symbol in field name
Date: Mon, 25 Apr 2011 12:21:19 -0700 (PDT)

Dear all,

How to overcome the following peculiarity??

>From an ascii data file I put the header section into a struct(). The
{variable,value} sets of that header are properly put in the struct() with
setfield().

On the command line I can extract the detector delay time with
getfield(structname,'Det delay [µs]')

But only from the command line!  When I put this in a script it seems to
not_find it ; probably due to the annoying 'µ' symbol (see below for why i
think so).

I see two possible solutions: 
1) replace the 'µ' in the text before converting to a struct (setfield()).
2) replace the 'µ' in search text when using getfield().

In either case I can't seem the get the replacement working, or I don't
understand howto:

octave:16> ff=toascii("µ")
ff =

   66   53

octave:17> char(ff)
ans = B5
octave:18> b="eeµ"
b = eeµ
octave:19> regexprep (b,char(ff),'u')
ans = eeµ
octave:20> strcat ('GG',char(ff),'t')
ans = GGB5t
octave:21> 

remarks:
1) The B5 code for the 'µ' symbol seems correct, but neither 'regexprep()'
nor 'strcat()' seem to correlate the code with the symbol.
2) I'm running Octave 3.4.0, compiled on Ubuntu 10.10 (utf8) and the ascii
data file is ISO-8859.

questions:
1) Is this a utf8 <-> ISO-8859 problem?
2) does regexprep() understand the B5 code as a 'µ' symbol? Do I need to
convert it?
3) In the commands as copied above, I have inserted the 'µ' into variable
'b' by copy-paste with the mouse inside my Octave terminal session. Does
that change ISO-8859 into UTF8?
4) Does anybody have a better idea how to cope with symbols like this that
become variable names in a struct?

many thanks

--
View this message in context: 
http://octave.1599824.n4.nabble.com/fields-not-found-in-struct-because-of-micro-symbol-in-field-name-tp3473913p3473913.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]