help-octave
[Top][All Lists]
Advanced

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

Re: Octave/Matlab compatibility


From: Richard J. Shaw
Subject: Re: Octave/Matlab compatibility
Date: Thu, 20 Nov 1997 11:31:57 +0000 (GMT)

> On 19-Nov-1997, Gopalakrishnan Harikumar <address@hidden> wrote:
> 
> | My problem is that some  matlab files still do
> | not work properly under octave. For example, the function
> | psd in Matlab's signal processing toolbox. 
> | 
> | For example, the following two lines which work okay in Matlab 4.x
> | 
> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^6
> | 
> | a = randn(100,1)
> | pa = psd(a,16,1,16) 
> | 
> | gives the following errors:
> | 
> | error: octave_base_value::string_value(): wrong type argument `matrix'
> | error: eval: expecting string argument
> | error: evaluating index expression near line 42, column 43
> | error: evaluating assignment expression near line 42, column 42
> | error: called from `psd' in file 

This is a problem I've encountered as well. The cause is a Matlab script
called "optargs" which is supposed to return a string for use by "eval".
The "optargs" script is used by a number of scripts other than "psd".

Under Octave, "optargs" can return a vector of character codes rather
than a string. I believe this is due to a statement in which a string
may be concatenated with a variable equal to the empty vector ([]).

Under Octave the behaviour is as follows :-

octave:1> fred = [[], "hello"]
fred =

  104  101  108  108  111

whereas under Matlab, fred becomes the string "hello".

It should be possible to fix this problem (on a one-off basis) by
replacing use of [] with '' :-

octave:2> fred = ['', "hello"]
fred = hello

which would be compatible with Matlab usage (single not double quotes!).

I don't know what the aesthetics or practicalities are of changing
Octave's behaviour in this respect (setstr_empty_vector=1 ?).

Hope this helps.
Richard.

P.S. Let me take this opportunity to say I'm a big fan of Octave
and to congratulate John on his responsiveness to user feedback.

-------------------------------------------------------------------------------
Richard Shaw       
Robat Project RA (Bat Lab (School of Biol. Sci.), CCR (Dept. of Engineering))
Web page : http://www.bio.bris.ac.uk/research/bats/richard/Personal.html
phone : (+44)(0) 117 9289000 ext 3796 or 3868   fax : (+44)(0) 117 9257374




reply via email to

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