help-octave
[Top][All Lists]
Advanced

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

Strcmp not behaving as expected


From: Mumble07
Subject: Strcmp not behaving as expected
Date: Sun, 21 Oct 2012 08:10:18 -0700 (PDT)

I'm writing a fairly simple plotting function in Octave with a number of
filenames, and I have a number of string comparison commands to sort the
datasets.  The problem is, the program kept behaving oddly, and after some
investigation, it seems that strcmp was the culprit and is acting completely
randomly with respect to the documentation.

Examples:

strcmp ('vent', 'vent') 

returns 

error: A(J,I): row index out of bounds; value 118 out of bound 114

and 

strcmp ('g_90', 'vent') 

returns a 4x4 unit matrix.

meanwhile

strcmp ('g_90', 'nograv')

returns a 4x6 matrix with 1's in the first and last columns and 0's
everywhere else.

I have a few other examples, but in general, strcmp is not reliably
comparing strings.





--
View this message in context: 
http://octave.1599824.n4.nabble.com/Strcmp-not-behaving-as-expected-tp4645565.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

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