help-octave
[Top][All Lists]
Advanced

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

Re: Strcmp not behaving as expected


From: Ben Abbott
Subject: Re: Strcmp not behaving as expected
Date: Sun, 21 Oct 2012 19:53:44 -0400

On Oct 21, 2012, at 11:10 AM, Mumble07 <address@hidden> wrote:

> 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.

What version of Octave are you running? And what does "which strcmp"  return?

Ben


reply via email to

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