index using end

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
asb
Reply | Threaded
Open this post in threaded view
|

index using end

asb
octave doesn't recognize end as an index
Example:
>> foo=[1 2 3]
foo =

   1   2   3

>> foo(end)
error: 'a' undefined near line 9 column 12
error: called from
    end at line 9 column 5
error: evaluating argument list element number 1
error: called from
    end at line 9 column 5
error: evaluating argument list element number 1

In addition, the library function index also fails:
>> img_file
img_file = dti.nii
>> index(img_file,".",directon="last")
error: 'a' undefined near line 9 column 12
error: called from
    end at line 9 column 5
    index at line 79 column 9
error: evaluating argument list element number 1
error: called from
    end at line 9 column 5
    index at line 79 column 9
error: evaluating argument list element number 1
error: called from
    index at line 79 column 9

I found an old message about this.  Has this just not been implemented yet,
or is there a patch?




--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: index using end

Doug Stewart-4


On Wed, Nov 15, 2017 at 5:14 PM, asb <[hidden email]> wrote:
octave doesn't recognize end as an index
Example:
>> foo=[1 2 3]
foo =

   1   2   3

>> foo(end)
error: 'a' undefined near line 9 column 12
error: called from
    end at line 9 column 5
error: evaluating argument list element number 1
error: called from
    end at line 9 column 5
error: evaluating argument list element number 1

In addition, the library function index also fails:
>> img_file
img_file = dti.nii
>> index(img_file,".",directon="last")
error: 'a' undefined near line 9 column 12
error: called from
    end at line 9 column 5
    index at line 79 column 9
error: evaluating argument list element number 1
error: called from
    end at line 9 column 5
    index at line 79 column 9
error: evaluating argument list element number 1
error: called from
    index at line 79 column 9

I found an old message about this.  Has this just not been implemented yet,
or is there a patch?




--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave


it works for me in octave 4.2.1
--
DASCertificate for 206392


_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: index using end

NJank


On Wed, Nov 15, 2017 at 5:22 PM, Doug Stewart <[hidden email]> wrote:


On Wed, Nov 15, 2017 at 5:14 PM, asb <[hidden email]> wrote:
octave doesn't recognize end as an index
Example:
>> foo=[1 2 3]
foo =

   1   2   3

>> foo(end)
error: 'a' undefined near line 9 column 12
error: called from
    end at line 9 column 5
error: evaluating argument list element number 1
error: called from
    end at line 9 column 5
error: evaluating argument list element number 1



works for me too:

>> foo = [1 2 3]
foo =

   1   2   3

>> foo(end)
ans =  3


have you tried clearing your workspace? since it's bringing up some error about a completely unrelated variable 'a', maybe you overwrote 'end' as a variable or function?


_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
asb
Reply | Threaded
Open this post in threaded view
|

Re: index using end

asb
I upgraded to 4.2.1, and it now works properly.



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave