From help-octave-request at bevo dot che dot wisc dot edu Sun Feb 1 08:33:28 2004 Subject: Re: Small problem in a if condition From: Pol To: help-octave at bevo dot che dot wisc dot edu Date: Sun, 1 Feb 2004 15:29:17 +0100 --Signature=_Sun__1_Feb_2004_15_29_17_+0100_Gl0SOKgjC4YcVLNt Content-Type: text/plain; charset=US-ASCII Content-Disposition: inline Content-Transfer-Encoding: 7bit Thanks alot it works :) -pol- On Sun, 01 Feb 2004 14:30:42 +0000 Geraint Paul Bevan 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 > ------------------------------------------------------------- --Signature=_Sun__1_Feb_2004_15_29_17_+0100_Gl0SOKgjC4YcVLNt Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQFAHQ1BRF2AKNGgnwYRAncgAJ4qHROjE8sKU7ED+VDHrJunhh4kVwCeP4q8 bfUCorBf2MlKIv86E9WS+w4= =GhyH -----END PGP SIGNATURE----- --Signature=_Sun__1_Feb_2004_15_29_17_+0100_Gl0SOKgjC4YcVLNt-- ------------------------------------------------------------- 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 -------------------------------------------------------------