help-octave
[Top][All Lists]
Advanced

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

Re: Help Request


From: Juan Pablo Carbajal
Subject: Re: Help Request
Date: Fri, 30 Sep 2011 15:41:21 +0200

Hi Vincenzo,

Please, always answer to the mailing list as well. I may be busy and
other people may help you before I go back to your question.
Additionally, you never knwon if other people will have a similar
problem in the future, and if they do our answers can be find in the
mailing list archives. We are not a help group or a customer service,
we just people like you, helping others because we will like to be
helped when we need it.

First, since it has been a hot topic lately, I will comment on your
contribution. If you have examples that you found useful (or you just
think they are), do write some documentation and send it to the
mailing list. The Octave community will be happy to enhance the
documentation with your help.

Now, concerning your question. If you are using linux, I would suggest
you to get the latest stable (3.4.2, soon to be 3.4.3)
http://www.gnu.org/software/octave/download.html . You can compile it
your own (is really easy, just scan the config.log file to see what
you are missing, and it doest take long), however Jordi says there are
people offering pre-compiled versions for many linux flavors.

OK, if you have a complex text file, but there is a structure you
knwon. You can always use fscanf, fgetl, fgets, etc... to get the data
you need.
As in the latest stable version 3.4.2, "textread" is a core function
and works fine to me.

Cheers,

On Fri, Sep 30, 2011 at 11:07 AM, Romanello, Vincenzo
<address@hidden> wrote:
> Hi Juan,
>
> Thank you so much for your answer. Yes: I solved the problem! Sorry for the 
> "silly question"...
> But I have some more important questions, if you don't mind:
>
> - in a previous installation command "textread" did not work at all: in order 
> to solve the problem I was forced to re-install Octave including ALL 
> packages! Could you tell whta is the right package which includes this 
> command?
>
> - I need desperately to read a complex input file whre both text and numbers 
> are present. I wish to load it in a one-dimension array for example, where 
> every word should be a cell, with a delimiter made by a blank " ".  I tried 
> with textread, but it reads only the first column, and it is not useful for 
> my case (in Matlab I adopted %q option). Do you have any hint about it?
>
> Thank you so much for your availability!
>
> Vincenzo
>
> P.S.:
> I think that more examples in Octave manual should greatly help: eventually I 
> should contribute...
>
> -----Original Message-----
> From: address@hidden [mailto:address@hidden On Behalf Of Juan Pablo Carbajal
> Sent: 29 September 2011 17:12
> To: Romanello, Vincenzo
> Cc: address@hidden
> Subject: Re: Help Request
>
> On Thu, Sep 29, 2011 at 11:51 AM, Romanello, Vincenzo <address@hidden> wrote:
>> Dear Ladies and Gentlemen,
>>
>>
>>
>> I am trying to switch from MATLAB to OCTAVE (the present version I
>> adopted is 3.2.4 - gcc 4.4.0), and I have to read a very simple text
>> file with "textread" function.
>>
>> I wrote the following program:
>>
>>
>>
>> function test
>>
>> clear
>>
>> disp("Begin")
>>
>> [a,b,c]=textread("data.txt","%d %d %d");
>>
>> a
>>
>> b
>>
>> c
>>
>> d=a+b+c
>>
>> disp("End")
>>
>> endfunction test
>>
>>
>>
>> data.txt looks like this:
>>
>>
>>
>> 1 2 3
>>
>> 4 5 6
>>
>> 7 8 9
>>
>>
>>
>> The point which puzzles me is that the procedure runs recursively
>> until it reaches the default limit then giving and error, while I wish
>> obviously to run it only once. I tried also to include a number in the
>> textread command (as textread("data.txt","%d %d %d",1) or
>> textread("data.txt","%d %d %d",-1)), but it doesn't work. I suspect it
>> is a bug... Is it? Should you suggest me something?
>>
>> Thank you in advance for your kind help.
>>
>> Best regards
>>
>>
>>
>> Vincenzo
>>
>>
>>
>>
>>
>> **********************************************************************
>> ******************************
>>
>> Karlsruhe Institute of Technology (KIT)
>>
>> Institute for Nuclear and Energy Technologies - IKET
>>
>>
>>
>> Dr. -Ing. Vincenzo Romanello
>>
>> Nuclear Scientist
>>
>>
>>
>> Hermann-von-Helmholtz-Platz, 1
>>
>> Building 421
>>
>> D - 76344 Eggenstein-Leopoldshafen, Germany
>>
>>
>>
>> Phone: +49 (0)721 608-23406
>>
>> Fax:     +49 (0)721 608-23824
>>
>> E-mail: address@hidden
>>
>> Web :   http://www.iket.kit.edu/142.php
>>
>>
>>
>> KIT - University of the State of Baden-Wuerttemberg and National
>> Research Center of the Helmholtz Association - www.kit.edu
>>
>> **********************************************************************
>> ******************************
>>
>>
>>
>> _______________________________________________
>> Help-octave mailing list
>> address@hidden
>> https://mailman.cae.wisc.edu/listinfo/help-octave
>>
>>
>
> Hi,
> First of all,
>
> "endfunction test" is not correct syntax. Use just "endfunction". Does this 
> solve the error?
>
>
>
> --
> M. Sc. Juan Pablo Carbajal
> -----
> PhD Student
> University of Zürich
> http://ailab.ifi.uzh.ch/carbajal/
>



-- 
M. Sc. Juan Pablo Carbajal
-----
PhD Student
University of Zürich
http://ailab.ifi.uzh.ch/carbajal/


reply via email to

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