[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: text and numbers
From: |
Daniel Heiserer |
Subject: |
Re: text and numbers |
Date: |
Thu, 18 Feb 1999 08:59:44 +0100 |
Huaiyu Zhu wrote:
>
> What's the best way to input text and data from the same file?
>
> This does not work:
>
> data = [
> 'name1' 12 34
> 'name2' 56 78
> ];
>
> I want to input a structure that has both text and numbers, and then
> separate out submatrices. Of course I can use perl and friends to
> separate them into two files and input them separately, but that
> introduces consistency issues.
>
> I remember asking this question about matlab once, but can't locate the
> answer now. Is octave behaving similarly to matlab in this regard?
>
> Thanks.
1)
Try fscanf and friends.
2)
The fastest way probably ist to do a
fread;reshape according to "\n" extract the columns you want and do a
eval or fscanf on
it to get the numerical values if wanted.
3)
For such things I NEVER go into octave or matlab.
Perl is the fastest AND most convenient way to do that.
Just include a perl script via "system" in a m-file which produces
some files "/tmp/a.ascii, /tmp/b.ascii" and an additional m-file
which says: "load /tmp/b.ascci;load /tmp/a.ascii"
and so on.
Example:
#my m-perl files
system("myperl.pl stuff");
loader
#loader
load /tmp/b.ascci;load /tmp/a.ascii
bye
--
Mit freundlichen Gruessen
Daniel Heiserer
-----
--------------------------------------------------------------
Dipl.-Phys. Daniel Heiserer, BMW AG, Knorrstrasse 147, 80788 Muenchen
Abteilung EK-20
Tel.: 089-382-21187, Fax.: 089-382-42820
mailto:address@hidden
- Re: Need a clue about compile failure in 2.1.13, (continued)
- Re: Need a clue about compile failure in 2.1.13, Joao Cardoso, 1999/02/10
- Re: Need a clue about compile failure in 2.1.13, John W. Eaton, 1999/02/11
- Re: Need a clue about compile failure in 2.1.13, O. Scott Sands, 1999/02/11
- Re: Need a clue about compile failure in 2.1.13, Thomas Walter, 1999/02/16
- Re: Need a clue about compile failure in 2.1.13, Joao Cardoso, 1999/02/16
- Re: Need a clue about compile failure in 2.1.13, Thomas Walter, 1999/02/17
- Re: Need a clue about compile failure in 2.1.13, Joao Cardoso, 1999/02/17
- Re: Need a clue about compile failure in 2.1.13, Thomas Walter, 1999/02/18
- Re: Need a clue about compile failure in 2.1.13, Joao Cardoso, 1999/02/18
- text and numbers, Huaiyu Zhu, 1999/02/17
- Re: text and numbers,
Daniel Heiserer <=
- Re: text and numbers, Karim Elaagouby, 1999/02/18