[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Small problem in a if condition
From: |
Pol |
Subject: |
Re: Small problem in a if condition |
Date: |
Sun, 1 Feb 2004 15:29:17 +0100 |
Thanks alot it works :)
-pol-
On Sun, 01 Feb 2004 14:30:42 +0000
Geraint Paul Bevan <address@hidden> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Pol wrote:
> | Hi there,
> |
> | I'm trying to convert that script from matlab to octave and I'm
> | hurting my head on that script:
> |
> | function zp = kzp(v,z,i)
> |
> | if (v == '?')
>
>
> You will need to use 'strcmp' to compare strings:
>
>
> function zp = kzp(v,z,i)
>
> if (strcmp (v, '?'))
> ~ d = z*i ;
> endif
>
> if (strcmp (z, '?'))
> ~ d = v/i ;
> endif
>
> if (strcmp (i, '?'))
> ~ d = v/z ;
> endif
>
> M = norm(d) ;
> P = angle(d)*180/pi ;
> zp=[M;P];
>
> endfunction
>
>
>
> octave> kzp (1,'?',3)
> ans =
>
> ~ 0.33333
> ~ 0.00000
>
>
> - --
> Geraint Bevan
> http://homepage.ntlworld.com/geraint.bevan
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.3 (GNU/Linux)
>
> iEYEARECAAYFAkAdDZEACgkQcXV3N50QmNN5RgCdGu5/Fhqoxa/mIaCjbVZ+GgGL
> lWkAoIY77UZ8NiYo+5myDpGK5BMhX5DY
> =CVtf
> -----END PGP SIGNATURE-----
>
>
>
> -------------------------------------------------------------
> Octave is freely available under the terms of the GNU GPL.
>
> Octave's home on the web: http://www.octave.org
> How to fund new projects: http://www.octave.org/funding.html
> Subscription information: http://www.octave.org/archive.html
> -------------------------------------------------------------
pgp8inDX7w0Mg.pgp
Description: PGP signature